ID: 24162 Updated by: [EMAIL PROTECTED] Reported By: marcus at gooseflesh dot de Status: Closed Bug Type: Documentation problem Operating System: Windows 2000 PHP Version: 4.3.2 New Comment:
Just to clarify: this changed after the release of 4.3.2, so currently, the documentation is not in fact accurate for the released version. However, the return type will be boolean for the next release, unless someone decides to change the behaviour back. For what it's work: before version 4.3.2, ftruncate() returns boolean FALSE if something in the PHP ftruncate() fails. Otherwise, an integer is returned which indicates the return value of the ftruncate() system call...on Linux, this would be 1 for success and 0 for failure. So Marcus, you were in fact correct with your original bug report. Thank you for the report, and I hope this clarifies matters. Torben Previous Comments: ------------------------------------------------------------------------ [2003-06-12 20:42:35] [EMAIL PROTECTED] I went through every reference/filesystem function and appropriately changed the following from int to bool: chgrp.xml chmod.xml chown.xml copy.xml link.xml mkdir.xml rewind.xml rmdir.xml symlink.xml touch.xml unlink.xml They will show up during the next manual build, thanks for the report! :) ------------------------------------------------------------------------ [2003-06-12 20:05:55] [EMAIL PROTECTED] It returns bool and is documented as such, thanks for the report. ------------------------------------------------------------------------ [2003-06-12 17:32:58] marcus at gooseflesh dot de Description: ------------ Hello folks, Of some reasons the return value of ftruncate($handle, $size) is of type int not of type bool. Is there a general reason that the half of the file functions return true and false as int and the other half true and false as bool ??? Marcus Wilhelm PHP is the best :)) Reproduce code: --------------- $handle = fopen("existing.file", "r+"); $return = ftruncate($handle, 17); if ( $return === true ) // does not match { echo "truncate ok, return value is bool"; } if ( $return == true ) // does match { echo "truncate ok, return value is bool or int"; } if ( $return == 1 ) // does match { echo "truncate ok, return value is int"; } Expected result: ---------------- the return value of ftruncate should be of type bool not of type int. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24162&edit=1 -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php