--TEST-- Test ftruncate() function : usage variations - truncate file to negative size --FILE-- getMessage() . \PHP_EOL; } var_dump( ftell($file_handle) ); var_dump( feof($file_handle) ); fclose($file_handle); clearstatcache(); // clear previous size value in cache $file_size = filesize($filename); // new file size = actual size, no change var_dump($file_size === 1024 || $file_size === 1137); // 1137 is for Windows with 't' mode //delete all files created delete_file( $filename ); }//end of inner for loop }//end of outer foreach loop echo "Done\n"; ?> --EXPECT-- *** Testing ftruncate() : usage variations *** -- Testing ftruncate() with file having data of type numeric -- -- Testing ftruncate() with file opening using r mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using rb mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using rt mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using r+ mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using r+b mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using r+t mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using w mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using wb mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using wt mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using w+ mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using w+b mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using w+t mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using x mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using xb mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using xt mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using x+ mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using x+b mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using x+t mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using a mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using ab mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using at mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using a+ mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using a+b mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using a+t mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file having data of type text_with_new_line -- -- Testing ftruncate() with file opening using r mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using rb mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using rt mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using r+ mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using r+b mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using r+t mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using w mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using wb mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using wt mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using w+ mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using w+b mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using w+t mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using x mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using xb mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using xt mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using x+ mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using x+b mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using x+t mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using a mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using ab mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using at mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using a+ mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using a+b mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) -- Testing ftruncate() with file opening using a+t mode -- -- Testing ftruncate(): try truncating file to a negative size -- bool(true) int(0) ftruncate(): Argument #2 ($size) must be greater than or equal to 0 int(0) bool(false) bool(true) Done