diff options
Diffstat (limited to 'ext/standard/tests/file')
119 files changed, 355 insertions, 5821 deletions
diff --git a/ext/standard/tests/file/005_error.phpt b/ext/standard/tests/file/005_error.phpt index e3ce551b3d..bc2bf3f978 100644 --- a/ext/standard/tests/file/005_error.phpt +++ b/ext/standard/tests/file/005_error.phpt @@ -29,31 +29,6 @@ var_dump( filemtime("/no/such/file/or/dir") ); var_dump( filectime("/no/such/file/or/dir") ); var_dump( touch("/no/such/file/or/dir", 10) ); -/* Only one invalid argument */ -var_dump( fileatime(__FILE__, "string") ); -var_dump( filemtime(__FILE__, 100) ); -var_dump( filectime(__FILE__, TRUE) ); -var_dump( touch(__FILE__, 10, 100, 123) ); - -echo "\n-- Testing No.of arguments less than expected --"; -var_dump( fileatime() ); -var_dump( filemtime() ); -var_dump( filectime() ); -var_dump( touch() ); - -echo "\n-- Testing No.of arguments greater than expected --"; -/* Both invalid arguments */ -var_dump( fileatime("/no/such/file/or/dir", "string") ); -var_dump( filemtime("/no/such/file/or/dir", 100) ); -var_dump( filectime("/no/such/file/or/dir", TRUE) ); -var_dump( touch("/no/such/file/or/dir", 10, 100, 123) ); - -/* Only one invalid argument */ -var_dump( fileatime(__FILE__, "string") ); -var_dump( filemtime(__FILE__, 100) ); -var_dump( filectime(__FILE__, TRUE) ); -var_dump( touch(__FILE__, 10, 100, 123) ); - echo "\nDone"; ?> --EXPECTF-- @@ -72,54 +47,4 @@ bool(false) Warning: touch(): Unable to create file /no/such/file/or/dir because No such file or directory in %s on line %d bool(false) -Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - --- Testing No.of arguments less than expected -- -Warning: fileatime() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: touch() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing No.of arguments greater than expected -- -Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - -Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/file/006_error.phpt b/ext/standard/tests/file/006_error.phpt index c35eba2128..e3bdda1b52 100644 --- a/ext/standard/tests/file/006_error.phpt +++ b/ext/standard/tests/file/006_error.phpt @@ -46,19 +46,6 @@ var_dump( chmod("/no/such/file/dir", 0777) ); var_dump( fileperms("/no/such/file/dir") ); echo "\n"; -/* With args less than expected */ -$fp = fopen(dirname(__FILE__)."/006_error.tmp", "w"); -fclose($fp); -var_dump( chmod(dirname(__FILE__)."/006_error.tmp") ); -var_dump( chmod("nofile") ); -var_dump( chmod() ); -var_dump( fileperms() ); - -/* With args greater than expected */ -var_dump( chmod(dirname(__FILE__)."/006_error.tmp", 0755, TRUE) ); -var_dump( fileperms(dirname(__FILE__)."/006_error.tmp", 0777) ); -var_dump( fileperms("nofile", 0777) ); - echo "\n*** Done ***\n"; ?> --CLEAN-- @@ -83,25 +70,4 @@ Warning: fileperms(): stat failed for /no/such/file/dir in %s on line %d bool(false) -Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: chmod() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: fileperms() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/006_variation2.phpt b/ext/standard/tests/file/006_variation2.phpt index 19bbf60fe9..cf81a83ea0 100644 --- a/ext/standard/tests/file/006_variation2.phpt +++ b/ext/standard/tests/file/006_variation2.phpt @@ -68,15 +68,23 @@ $perms_array = array( $count = 1; foreach($perms_array as $permission) { echo "-- Iteration $count --\n"; - var_dump( chmod($file_name, $permission) ); - printf("%o", fileperms($file_name) ); - echo "\n"; - clearstatcache(); - - var_dump( chmod($dir_name, $permission) ); - printf("%o", fileperms($dir_name) ); - echo "\n"; - clearstatcache(); + try { + var_dump( chmod($file_name, $permission) ); + printf("%o", fileperms($file_name) ); + echo "\n"; + clearstatcache(); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + try { + var_dump( chmod($dir_name, $permission) ); + printf("%o", fileperms($dir_name) ); + echo "\n"; + clearstatcache(); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } echo "*** Done ***\n"; @@ -148,39 +156,15 @@ bool(true) bool(true) 43567 -- Iteration 12 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given -- Iteration 13 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given -- Iteration 14 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given -- Iteration 15 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given *** Done *** diff --git a/ext/standard/tests/file/007_error.phpt b/ext/standard/tests/file/007_error.phpt deleted file mode 100644 index 93a6a23e5f..0000000000 --- a/ext/standard/tests/file/007_error.phpt +++ /dev/null @@ -1,185 +0,0 @@ ---TEST-- -Test fopen, fclose() & feof() functions: error conditions ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* - Prototype: resource fopen(string $filename, string $mode - [, bool $use_include_path [, resource $context]] ); - Description: Opens file or URL. - - Prototype: bool fclose ( resource $handle ); - Description: Closes an open file pointer - - Prototype: bool feof ( resource $handle ) - Description: Returns TRUE if the file pointer is at EOF or an error occurs - (including socket timeout); otherwise returns FALSE. -*/ - -echo "*** Testing error conditions for fopen(), fclsoe() & feof() ***\n"; -/* Arguments less than minimum no.of args */ - -// fopen () -var_dump(fopen(__FILE__)); // one valid argument -var_dump(fopen()); // zero argument - -// fclose() -$fp = fopen(__FILE__, "r"); -fclose($fp); -var_dump( fclose($fp) ); // closed handle -var_dump( fclose(__FILE__) ); // invalid handle -var_dump( fclose() ); // zero argument - -//feof() -var_dump( feof($fp) ); // closed handle -var_dump( feof(__FILE__) ); // invalid handle -var_dump( feof() ); //zero argument - -/* Arguments greater than maximum no.of ags */ -var_dump(fopen(__FILE__, "r", TRUE, "www.example.com", 100)); - -$fp = fopen(__FILE__, "r"); -var_dump( fclose($fp, "handle") ); - -var_dump( feof($fp, "handle")); -fclose($fp); - -/* test invalid arguments : non-resources */ -echo "-- Testing fopen(), fclose() & feof() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, - NULL, - "" -); - -/* loop to test fclose with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fopen($invalid_args[$loop_counter - 1], "r") ); - var_dump( fclose($invalid_args[$loop_counter - 1]) ); - var_dump( feof($invalid_args[$loop_counter - 1]) ); -} - -?> ---EXPECTF-- -*** Testing error conditions for fopen(), fclsoe() & feof() *** - -Warning: fopen() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: fopen() expects at least 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: fclose(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: fclose() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: feof() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: fopen() expects at most 4 parameters, 5 given in %s on line %d -bool(false) - -Warning: fclose() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: feof() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) --- Testing fopen(), fclose() & feof() with invalid arguments -- --- Iteration 1 -- - -Warning: fopen(string): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fopen(10): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, int given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fopen(10.5): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, float given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fopen(1): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fopen() expects parameter 1 to be a valid path, array given in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fopen() expects parameter 1 to be a valid path, object given in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, object given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: fopen(): Filename cannot be empty in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, null given in %s on line %d -bool(false) --- Iteration 8 -- - -Warning: fopen(): Filename cannot be empty in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, string given in %s on line %d -bool(false) diff --git a/ext/standard/tests/file/basename-win32.phpt b/ext/standard/tests/file/basename-win32.phpt index 996b060cea..703861dec7 100644 --- a/ext/standard/tests/file/basename-win32.phpt +++ b/ext/standard/tests/file/basename-win32.phpt @@ -115,23 +115,6 @@ check_basename( $file_paths ); echo "\n*** Testing possible variations in path and suffix ***\n"; check_basename( $file_path_variations ); -echo "\n*** Testing error conditions ***\n"; -// zero arguments -var_dump( basename() ); - -// more than expected no. of arguments -var_dump( basename("\\blah\\tmp\\bar.zip", ".zip", ".zip") ); - -// passing invalid type arguments -$object = new stdclass; -var_dump( basename( array("string\\bar") ) ); -var_dump( basename( array("string\\bar"), "bar" ) ); -var_dump( basename( "bar", array("string\\bar") ) ); -var_dump( basename( $object, "bar" ) ); -var_dump( basename( $object ) ); -var_dump( basename( $object, $object ) ); -var_dump( basename( "bar", $object ) ); - echo "Done\n"; ?> --EXPECTF-- @@ -309,33 +292,4 @@ string(0) "" --Iteration 32-- string(0) "" - -*** Testing error conditions *** - -Warning: basename() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: basename() expects at most 2 parameters, 3 given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: basename() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: basename() expects parameter 2 to be string, object given in %s on line %d -NULL Done diff --git a/ext/standard/tests/file/basename.phpt b/ext/standard/tests/file/basename.phpt Binary files differindex a9b4389b5a..8352f4da4b 100644 --- a/ext/standard/tests/file/basename.phpt +++ b/ext/standard/tests/file/basename.phpt diff --git a/ext/standard/tests/file/bug39863.phpt b/ext/standard/tests/file/bug39863.phpt index 5460203e05..174e349b15 100644 --- a/ext/standard/tests/file/bug39863.phpt +++ b/ext/standard/tests/file/bug39863.phpt @@ -7,16 +7,11 @@ Andrew van der Stock, vanderaj @ owasp.org $filename = __FILE__ . chr(0). ".ridiculous"; -if (file_exists($filename)) { - echo "FAIL\n"; -} -else { - echo "PASS\n"; +try { + var_dump(file_exists($filename)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; } ?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d -PASS -===DONE=== +--EXPECT-- +file_exists() expects parameter 1 to be a valid path, string given diff --git a/ext/standard/tests/file/bug72035.phpt b/ext/standard/tests/file/bug72035.phpt index feb4eb9acd..eb784f737d 100644 --- a/ext/standard/tests/file/bug72035.phpt +++ b/ext/standard/tests/file/bug72035.phpt @@ -3,7 +3,6 @@ Bug #72035 php-cgi.exe fails to run scripts relative to drive root --SKIPIF-- <?php if(substr(PHP_OS, 0, 3) != 'WIN' ) die('skip windows only test'); -if(php_sapi_name() != "cli") die('skip CLI only test'); $cgi = realpath(dirname(PHP_BINARY)) . DIRECTORY_SEPARATOR . "php-cgi.exe"; if (!file_exists($cgi)) die('skip CGI binary not found'); diff --git a/ext/standard/tests/file/chmod_error.phpt b/ext/standard/tests/file/chmod_error.phpt index 3b234c741f..b7999aa03d 100644 --- a/ext/standard/tests/file/chmod_error.phpt +++ b/ext/standard/tests/file/chmod_error.phpt @@ -10,19 +10,6 @@ Test chmod() function : error conditions echo "*** Testing chmod() : error conditions ***\n"; - -//Test chmod with one more than the expected number of arguments -echo "\n-- Testing chmod() function with more than expected no. of arguments --\n"; -$filename = 'string_val'; -$mode = 10; -$extra_arg = 10; -var_dump( chmod($filename, $mode, $extra_arg) ); - -// Testing chmod with one less than the expected number of arguments -echo "\n-- Testing chmod() function with less than expected no. of arguments --\n"; -$filename = 'string_val'; -var_dump( chmod($filename) ); - // testing chmod with a non-existing file $filename = "___nonExisitingFile___"; var_dump(chmod($filename, 0777)); @@ -32,16 +19,6 @@ var_dump(chmod($filename, 0777)); --EXPECTF-- *** Testing chmod() : error conditions *** --- Testing chmod() function with more than expected no. of arguments -- - -Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d -NULL - --- Testing chmod() function with less than expected no. of arguments -- - -Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: chmod(): No such file or directory in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/file/copy_error.phpt b/ext/standard/tests/file/copy_error.phpt index 2d6395167b..36eb58fc2a 100644 --- a/ext/standard/tests/file/copy_error.phpt +++ b/ext/standard/tests/file/copy_error.phpt @@ -11,13 +11,6 @@ echo "*** Testing copy() function: error conditions --\n"; /* Invalid args */ var_dump( copy("/no/file", "file") ); -/* No.of args less than expected */ -var_dump( copy() ); -var_dump( copy(__FILE__) ); - -/* No.of args less than expected */ -var_dump( copy(__FILE__, "file1", "file1") ); - echo "*** Done ***\n"; ?> --EXPECTF-- @@ -25,13 +18,4 @@ echo "*** Done ***\n"; Warning: copy(/no/file): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: copy() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: copy() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: copy() expects parameter 3 to be resource, string given in %s on line %d -NULL *** Done *** diff --git a/ext/standard/tests/file/copy_variation4.phpt b/ext/standard/tests/file/copy_variation4.phpt Binary files differindex 3c3abea05a..8a2f8972fc 100644 --- a/ext/standard/tests/file/copy_variation4.phpt +++ b/ext/standard/tests/file/copy_variation4.phpt diff --git a/ext/standard/tests/file/disk.phpt b/ext/standard/tests/file/disk.phpt index a048af6ccb..fe415535ba 100644 --- a/ext/standard/tests/file/disk.phpt +++ b/ext/standard/tests/file/disk.phpt @@ -11,9 +11,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { --FILE-- <?php -var_dump(disk_free_space()); -var_dump(disk_total_space()); - var_dump(disk_free_space(-1)); var_dump(disk_total_space(-1)); @@ -26,12 +23,6 @@ var_dump(disk_total_space("/some/path/here")); echo "Done\n"; ?> --EXPECTF-- -Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - Warning: disk_free_space(): No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_free_space_error-win32.phpt b/ext/standard/tests/file/disk_free_space_error-win32.phpt index acb0fdd717..35140d23fb 100644 --- a/ext/standard/tests/file/disk_free_space_error-win32.phpt +++ b/ext/standard/tests/file/disk_free_space_error-win32.phpt @@ -16,12 +16,6 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) echo "*** Testing error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( disk_free_space() ); // Zero Arguments -var_dump( diskfreespace() ); - -var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments -var_dump( diskfreespace( $file_path, "extra argument") ); - var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory var_dump( diskfreespace( $file_path."/dir1" )); @@ -43,18 +37,6 @@ unlink($file_path."/disk_free_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_free_space(): The system cannot find the path specified. in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_free_space_error.phpt b/ext/standard/tests/file/disk_free_space_error.phpt index 6433cde702..00ec271f8d 100644 --- a/ext/standard/tests/file/disk_free_space_error.phpt +++ b/ext/standard/tests/file/disk_free_space_error.phpt @@ -16,12 +16,6 @@ if(substr(PHP_OS, 0, 3) == 'WIN') echo "*** Testing error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( disk_free_space() ); // Zero Arguments -var_dump( diskfreespace() ); - -var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments -var_dump( diskfreespace( $file_path, "extra argument") ); - var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory var_dump( diskfreespace( $file_path."/dir1" )); @@ -43,18 +37,6 @@ unlink($file_path."/disk_free_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_free_space(): No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_free_space_variation.phpt b/ext/standard/tests/file/disk_free_space_variation.phpt index 6c6575d896..912648f100 100644 --- a/ext/standard/tests/file/disk_free_space_variation.phpt +++ b/ext/standard/tests/file/disk_free_space_variation.phpt @@ -48,8 +48,16 @@ $count = 1; /* loop through to test each element the above array */ foreach($dirs_arr as $dir1) { echo "\n-- Iteration $count --\n"; - var_dump( disk_free_space( $dir1 ) ); - var_dump( diskfreespace( $dir1 ) ); + try { + var_dump( disk_free_space( $dir1 ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( diskfreespace( $dir1 ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } @@ -102,35 +110,19 @@ float(%d) float(%d) -- Iteration 9 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given -- Iteration 10 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given -- Iteration 11 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given -- Iteration 12 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given --- Done --- diff --git a/ext/standard/tests/file/disk_total_space_error-win32.phpt b/ext/standard/tests/file/disk_total_space_error-win32.phpt index 0d511b37a7..29462bb31c 100644 --- a/ext/standard/tests/file/disk_total_space_error-win32.phpt +++ b/ext/standard/tests/file/disk_total_space_error-win32.phpt @@ -16,10 +16,6 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) echo "*** Testing error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( disk_total_space() ); // Zero Arguments - -var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments - var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory @@ -38,12 +34,6 @@ unlink($file_path."/disk_total_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_total_space(): The system cannot find the path specified. in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_total_space_error.phpt b/ext/standard/tests/file/disk_total_space_error.phpt index 2c8a940117..b504727089 100644 --- a/ext/standard/tests/file/disk_total_space_error.phpt +++ b/ext/standard/tests/file/disk_total_space_error.phpt @@ -16,10 +16,6 @@ if(substr(PHP_OS, 0, 3) == 'WIN') echo "*** Testing error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( disk_total_space() ); // Zero Arguments - -var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments - var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory @@ -38,12 +34,6 @@ unlink($file_path."/disk_total_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_total_space(): No such file or directory in %s on line %d bool(false) float(%d) diff --git a/ext/standard/tests/file/disk_total_space_variation.phpt b/ext/standard/tests/file/disk_total_space_variation.phpt index 071fa60749..89c47dcaba 100644 --- a/ext/standard/tests/file/disk_total_space_variation.phpt +++ b/ext/standard/tests/file/disk_total_space_variation.phpt @@ -49,7 +49,11 @@ $count = 1; /* loop through to test each element the above array */ foreach($dirs_arr as $dir1) { echo "\n-- Iteration $count --\n"; - var_dump( disk_total_space( $dir1 ) ); + try { + var_dump( disk_total_space( $dir1 ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } @@ -96,25 +100,17 @@ float(%d) float(%d) -- Iteration 9 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given -- Iteration 10 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given -- Iteration 11 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given -- Iteration 12 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given *** Testing with Binary Input *** -float(%d) +float(%s) --- Done --- diff --git a/ext/standard/tests/file/fgetc_variation2.phpt b/ext/standard/tests/file/fgetc_variation2.phpt index d444209af4..dd0dbb2096 100644 --- a/ext/standard/tests/file/fgetc_variation2.phpt +++ b/ext/standard/tests/file/fgetc_variation2.phpt @@ -26,15 +26,6 @@ fclose($file_handle); // read from closed file var_dump( fgetc($file_handle) ); -echo "-- Testing fgetc() with unset handle --\n"; -// open the file for reading -$file_handle = fopen(__FILE__, "r"); -// unset the file handle -unset($file_handle); - -//fgetc using unset handle -var_dump( fgetc($file_handle) ); - echo "Done"; ?> --EXPECTF-- @@ -43,10 +34,4 @@ echo "Done"; Warning: fgetc(): supplied resource is not a valid stream resource in %s on line %d bool(false) --- Testing fgetc() with unset handle -- - -Notice: Undefined variable: file_handle in %s on line %d - -Warning: fgetc() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fgets_error.phpt b/ext/standard/tests/file/fgets_error.phpt index 919343aa87..eed35b3001 100644 --- a/ext/standard/tests/file/fgets_error.phpt +++ b/ext/standard/tests/file/fgets_error.phpt @@ -8,14 +8,8 @@ Test fgets() function : error conditions */ echo "*** Testing error conditions ***\n"; -// zero argument -echo "-- Testing fgets() with zero argument --\n"; -var_dump( fgets() ); -// more than expected no. of args -echo "-- Testing fgets() with more than expected number of arguments --\n"; $fp = fopen(__FILE__, "r"); -var_dump( fgets($fp, 10, $fp) ); // invalid length argument echo "-- Testing fgets() with invalid length arguments --\n"; @@ -26,45 +20,10 @@ var_dump( fgets($fp, $len) ); $len = 1; var_dump( fgets($fp, $len) ); // return length - 1 always, expect false - -// test invalid arguments : non-resources -echo "-- Testing fgets() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fgets() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fgets($invalid_args[$loop_counter - 1], 10) ); -} - -// fgets() on a file handle which is already closed -echo "-- Testing fgets() with closed/unset file handle --"; -fclose($fp); -var_dump(fgets($fp,10)); - -// fgets() on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( fgets(@$file_handle,10)); - echo "Done\n"; ?> --EXPECTF-- *** Testing error conditions *** --- Testing fgets() with zero argument -- - -Warning: fgets() expects at least 1 parameter, 0 given in %s on line %d -bool(false) --- Testing fgets() with more than expected number of arguments -- - -Warning: fgets() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -- Testing fgets() with invalid length arguments -- Warning: fgets(): Length parameter must be greater than 0 in %s on line %d @@ -73,35 +32,4 @@ bool(false) Warning: fgets(): Length parameter must be greater than 0 in %s on line %d bool(false) bool(false) --- Testing fgets() with invalid arguments -- --- Iteration 1 -- - -Warning: fgets() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fgets() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fgets() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fgets() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fgets() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fgets() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Testing fgets() with closed/unset file handle -- -Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fgets_variation2.phpt b/ext/standard/tests/file/fgets_variation2.phpt index 0bbcf22039..aa8beb2d4d 100644 --- a/ext/standard/tests/file/fgets_variation2.phpt +++ b/ext/standard/tests/file/fgets_variation2.phpt @@ -27,16 +27,6 @@ fclose($file_handle); var_dump( fgets($file_handle) ); // default length var_dump( fgets($file_handle, 10) ); // with specific length -echo "-- Testing fgets() with unset handle --\n"; -// open the file for reading -$file_handle = fopen(__FILE__, "r"); -// unset the file handle -unset($file_handle); - -//fgets using unset handle -var_dump( fgets($file_handle) ); // default length -var_dump( fgets($file_handle, 10) ); // with specific length - echo "Done"; ?> --EXPECTF-- @@ -48,15 +38,4 @@ bool(false) Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d bool(false) --- Testing fgets() with unset handle -- - -Notice: Undefined variable: file_handle in %s on line %d - -Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Notice: Undefined variable: file_handle in %s on line %d - -Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fgetss.phpt b/ext/standard/tests/file/fgetss.phpt deleted file mode 100644 index 41ac46dc92..0000000000 --- a/ext/standard/tests/file/fgetss.phpt +++ /dev/null @@ -1,144 +0,0 @@ ---TEST-- -fgetss() tests ---FILE-- -<?php - -$filename = dirname(__FILE__)."/fgetss.html"; - -$array = array( - "askasdfasdf<b>aaaaaa\n</b>dddddd", - "asdqw<i onClick=\"hello();\">\naaaa<>qqqq", - "aaa<script>function foo() {}</script>qqq", - "asdasd<a\n asdjeje", - "", - "some text \n<b>blah</i>", - "some another text <> hoho </>" - ); - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp)); - var_dump(fgetss($fp)); -} - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 10)); - var_dump(fgetss($fp, 10)); -} - -var_dump(fgetss($fp, -10)); -var_dump(fgetss($fp, 0)); -fclose($fp); -var_dump(fgetss($fp, 0)); - -@unlink($filename); - -echo "Done\n"; -?> ---EXPECTF-- -Deprecated: Function fgetss() is deprecated in %s on line %d -string(18) "askasdfasdfaaaaaa -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "dddddd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdqw -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(8) "aaaaqqqq" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(23) "aaafunction foo() {}qqq" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdasd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(11) "some text -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(4) "blah" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(24) "some another text hoho " - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "askasdfas" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "dfaaaa" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(5) "asdqw" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(3) "aaa" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(7) "functio" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdasd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "some text" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(2) " -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "some anot" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "her text " - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): supplied resource is not a valid stream resource in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss1.phpt b/ext/standard/tests/file/fgetss1.phpt deleted file mode 100644 index 0266371865..0000000000 --- a/ext/standard/tests/file/fgetss1.phpt +++ /dev/null @@ -1,73 +0,0 @@ ---TEST-- -more fgetss() tests ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -$filename = dirname(__FILE__)."/fgetss1.html"; - -$array = array( - "askasdfasdf<b>aaaaaa\n</b>dddddd", - "asdqw<i onClick=\"hello();\">\naaaa<>qqqq", - "aaa<script>function foo() {}</script>qqq", - "asdasd<a\n asdjeje", - "", - "some text \n<b>blah</i>", - "some another text <> hoho </>" - ); - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 1000, "<i>,<b>,<a>")); - var_dump(fgetss($fp)); -} - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 10)); - var_dump(fgetss($fp, 10, "<script>,<a>")); -} - -echo "Done\n"; -?> ---CLEAN-- -<?php -$filename = dirname(__FILE__)."/fgetss1.html"; -unlink($filename); -?> ---EXPECT-- -string(21) "askasdfasdf<b>aaaaaa -" -string(6) "dddddd" -string(28) "asdqw<i onClick="hello();"> -" -string(8) "aaaaqqqq" -string(23) "aaafunction foo() {}qqq" -bool(false) -string(6) "asdasd" -string(0) "" -bool(false) -bool(false) -string(11) "some text -" -string(4) "blah" -string(24) "some another text hoho " -bool(false) -string(9) "askasdfas" -string(6) "dfaaaa" -string(5) "asdqw" -string(0) "" -string(3) "aaa" -string(9) "t>functio" -string(6) "asdasd" -string(0) "" -bool(false) -bool(false) -string(9) "some text" -string(2) " -" -string(9) "some anot" -string(9) "her text " -Done diff --git a/ext/standard/tests/file/fgetss_basic1.phpt b/ext/standard/tests/file/fgetss_basic1.phpt deleted file mode 100644 index b1e4a89c64..0000000000 --- a/ext/standard/tests/file/fgetss_basic1.phpt +++ /dev/null @@ -1,137 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read modes only ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* test fgetss with all read modes */ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : Basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; - -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} -/* try reading the file opened in different modes of reading */ -$file_modes = array("r","rb", "rt","r+", "r+b", "r+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $filename = dirname(__FILE__)."/fgetss_basic1.tmp"; - create_file ($filename); //create an empty file - file_put_contents($filename, $string_with_tags); - $file_handle = fopen($filename, $file_modes[$mode_counter]); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - rewind($file_handle); - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : Basic operations *** - --- Testing fgetss() with file opened using r mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using rb mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using rt mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using r+ mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using r+b mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using r+t mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt b/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt deleted file mode 100644 index 41ebf8e1da..0000000000 --- a/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt +++ /dev/null @@ -1,218 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only on Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} -$filename = dirname(__FILE__)."/fgetss_basic2私はガラスを食べられます.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : basic operations *** - --- Testing fgetss() with file opened using w+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_basic2-win32.phpt b/ext/standard/tests/file/fgetss_basic2-win32.phpt deleted file mode 100644 index ea76bb8a8b..0000000000 --- a/ext/standard/tests/file/fgetss_basic2-win32.phpt +++ /dev/null @@ -1,218 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only on Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} -$filename = dirname(__FILE__)."/fgetss_basic2.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : basic operations *** - --- Testing fgetss() with file opened using w+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_basic2.phpt b/ext/standard/tests/file/fgetss_basic2.phpt deleted file mode 100644 index d77689d980..0000000000 --- a/ext/standard/tests/file/fgetss_basic2.phpt +++ /dev/null @@ -1,216 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; - -$filename = dirname(__FILE__)."/fgetss_basic2.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : basic operations *** - --- Testing fgetss() with file opened using w+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+t mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+t mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+t mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_error.phpt b/ext/standard/tests/file/fgetss_error.phpt deleted file mode 100644 index 13a5399406..0000000000 --- a/ext/standard/tests/file/fgetss_error.phpt +++ /dev/null @@ -1,108 +0,0 @@ ---TEST-- -Test fgetss() function : error conditions ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -echo "*** Testing error conditions ***\n"; -// zero argument -echo "-- Testing fgetss() with zero argument --\n"; -var_dump( fgetss() ); - -// more than expected no. of args -echo "-- Testing fgetss() with more than expected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( fgetss($fp, 100, '<p><a>', $fp) ); - -// invalid length argument -echo "-- Testing fgetss() with invalid length arguments --\n"; -$len = 0; -$allowable_tags = '<p><a>'; -var_dump( fgetss($fp, $len, $allowable_tags) ); -$len = -10; -var_dump( fgetss($fp, $len, $allowable_tags) ); -$len = 1; -var_dump( fgetss($fp, $len, $allowable_tags) ); // return length - 1 always, expect false - -// test invalid arguments : non-resources -echo "-- Testing fgetss() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fgetss() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fgetss($invalid_args[$loop_counter - 1], 10, $allowable_tags) ); -} -// fgetss() on a file handle which is already closed -echo "-- Testing fgetss() with closed/unset file handle --"; -fclose($fp); -var_dump(fgetss($fp,10,$allowable_tags)); - -// fgetss() on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( fgetss(@$file_handle,10)); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing error conditions *** --- Testing fgetss() with zero argument -- - -Warning: fgetss() expects at least 1 parameter, 0 given in %s on line %d -bool(false) --- Testing fgetss() with more than expected number of arguments -- - -Warning: fgetss() expects at most 3 parameters, 4 given in %s on line %d -bool(false) --- Testing fgetss() with invalid length arguments -- - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) -bool(false) --- Testing fgetss() with invalid arguments -- --- Iteration 1 -- - -Warning: fgetss() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fgetss() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fgetss() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fgetss() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fgetss() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fgetss() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Testing fgetss() with closed/unset file handle -- -Warning: fgetss(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fgetss() expects parameter 1 to be resource, null given in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_variation1-win32.phpt b/ext/standard/tests/file/fgetss_variation1-win32.phpt deleted file mode 100644 index b8ad242d9e..0000000000 --- a/ext/standard/tests/file/fgetss_variation1-win32.phpt +++ /dev/null @@ -1,174 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - write only modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only on Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgets on files which are opened in non readable modes - w, wb, wt, - a, ab, at, - x, xb, xt -*/ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} - -$filename = dirname(__FILE__)."/fgetss_variation1.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w","wb", "wt","a", "ab", "at","x","xb","xt"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 , expected : no character should be read --\n"; - var_dump( fgetss($file_handle) ); // expected : no character should be read - var_dump( ftell($file_handle) ); //ensure that file pointer position is not changed - var_dump( feof($file_handle) ); // check if end of file pointer is set - - // close the file - fclose($file_handle); - - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wt mode -- -int(453) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using a mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using ab mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using at mode -- -int(453) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using x mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xt mode -- -int(453) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_variation1.phpt b/ext/standard/tests/file/fgetss_variation1.phpt deleted file mode 100644 index 6166f8468c..0000000000 --- a/ext/standard/tests/file/fgetss_variation1.phpt +++ /dev/null @@ -1,170 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - write only modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgets on files which are opened in non readable modes - w, wb, wt, - a, ab, at, - x, xb, xt -*/ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation1.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w","wb", "wt","a", "ab", "at","x","xb","xt"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 , expected : no character should be read --\n"; - var_dump( fgetss($file_handle) ); // expected : no character should be read - var_dump( ftell($file_handle) ); //ensure that file pointer position is not changed - var_dump( feof($file_handle) ); // check if end of file pointer is set - - // close the file - fclose($file_handle); - - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wt mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using a mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using ab mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using at mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using x mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xt mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_variation2.phpt b/ext/standard/tests/file/fgetss_variation2.phpt deleted file mode 100644 index 228d476079..0000000000 --- a/ext/standard/tests/file/fgetss_variation2.phpt +++ /dev/null @@ -1,436 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read modes ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -// include the common file related test functions -include ("file.inc"); - -/*Test fgetss() with all read modes , reading line by line with allowable tags: <test>, <html>, <?> */ - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this is the text containing \r character -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation2.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("r","rb", "rt","r+", "r+b", "r+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - create_file ($filename); //create an empty file - file_put_contents($filename, $string_with_tags); - $file_handle = fopen($filename, $file_modes[$mode_counter]); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* rewind the file and read the file line by line with allowable tags */ - echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n"; - rewind($file_handle); - $line = 1; - while( !feof($file_handle) ) { - echo "-- Line $line --\n"; $line++; - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // check the file pointer position - var_dump( feof($file_handle) ); // check if eof reached - } - - // close the file - fclose($file_handle); - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using r mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using rb mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using rt mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using r+ mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using r+b mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using r+t mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation3-win32.phpt b/ext/standard/tests/file/fgetss_variation3-win32.phpt deleted file mode 100644 index c1777fc495..0000000000 --- a/ext/standard/tests/file/fgetss_variation3-win32.phpt +++ /dev/null @@ -1,573 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t - reading line by line with allowable tags: <test>, <html>, <?> -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} - -$filename = dirname(__FILE__)."/fgetss_variation3.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - rewind($file_handle); - var_dump( ftell($file_handle) ); - var_dump( filesize($filename) ); - var_dump( feof($file_handle) ); - - /* rewind the file and read the file line by line with allowable tags */ - echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n"; - $line = 1; - while( !feof($file_handle) ) { - echo "-- Line $line --\n"; $line++; - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // check the file pointer position - var_dump( feof($file_handle) ); // check if eof reached - } - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(0) -int(453) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(0) -int(453) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(0) -int(453) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation3.phpt b/ext/standard/tests/file/fgetss_variation3.phpt deleted file mode 100644 index 53a2ac879c..0000000000 --- a/ext/standard/tests/file/fgetss_variation3.phpt +++ /dev/null @@ -1,569 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t - reading line by line with allowable tags: <test>, <html>, <?> -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation3.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - rewind($file_handle); - var_dump( ftell($file_handle) ); - var_dump( filesize($filename) ); - var_dump( feof($file_handle) ); - - /* rewind the file and read the file line by line with allowable tags */ - echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n"; - $line = 1; - while( !feof($file_handle) ) { - echo "-- Line $line --\n"; $line++; - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // check the file pointer position - var_dump( feof($file_handle) ); // check if eof reached - } - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation4.phpt b/ext/standard/tests/file/fgetss_variation4.phpt deleted file mode 100644 index 91470e1d44..0000000000 --- a/ext/standard/tests/file/fgetss_variation4.phpt +++ /dev/null @@ -1,170 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read modes, file pointer at EOF ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) == "WIN") - die("skip not for Windows"); -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this is the text containing \r character -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation4.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("r","rb", "rt","r+", "r+b", "r+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - create_file ($filename); //create an empty file - file_put_contents($filename, $string_with_tags); - $file_handle = fopen($filename, $file_modes[$mode_counter]); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - echo "-- Reading when file pointer points to EOF --\n"; - var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end - var_dump( ftell($file_handle) ); //ensure file pointer at end - var_dump( fgetss($file_handle) ); // try to read - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // now file is at the end try reading with length and allowable tags,expecting false - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // close the file - fclose($file_handle); - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using r mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using rb mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using rt mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using r+ mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using r+b mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using r+t mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation5-win32.phpt b/ext/standard/tests/file/fgetss_variation5-win32.phpt deleted file mode 100644 index 57f1fd9059..0000000000 --- a/ext/standard/tests/file/fgetss_variation5-win32.phpt +++ /dev/null @@ -1,222 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes, file pointer at EOF ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} - -$filename = dirname(__FILE__)."/fgetss_variation5.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - echo "-- Reading when file pointer points to EOF --\n"; - var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end - var_dump( ftell($file_handle) ); //ensure file pointer at end - var_dump( fgetss($file_handle) ); // try to read - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // now file is at the end try reading with length and allowable tags,expecting false - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(453) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(453) -bool(false) -int(453) -bool(true) -bool(false) -int(453) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(453) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(453) -bool(false) -int(453) -bool(true) -bool(false) -int(453) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(453) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(453) -bool(false) -int(453) -bool(true) -bool(false) -int(453) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation5.phpt b/ext/standard/tests/file/fgetss_variation5.phpt deleted file mode 100644 index e6fc15a98c..0000000000 --- a/ext/standard/tests/file/fgetss_variation5.phpt +++ /dev/null @@ -1,219 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes, file pointer at EOF ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation5.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - echo "-- Reading when file pointer points to EOF --\n"; - var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end - var_dump( ftell($file_handle) ); //ensure file pointer at end - var_dump( fgetss($file_handle) ); // try to read - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // now file is at the end try reading with length and allowable tags,expecting false - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) -Done diff --git a/ext/standard/tests/file/file_error.phpt b/ext/standard/tests/file/file_error.phpt index 12148189e8..2efacd1b31 100644 --- a/ext/standard/tests/file/file_error.phpt +++ b/ext/standard/tests/file/file_error.phpt @@ -8,14 +8,10 @@ Test file() function : error conditions Returns the file in an array */ $file_path = dirname(__FILE__); -echo "\n*** Testing error conditions ***"; +echo "\n*** Testing error conditions ***\n"; $file_handle = fopen($file_path."/file.tmp", "w"); -var_dump( file() ); // Zero No. of args $filename = $file_path."/file.tmp"; -var_dump( file($filename, $filename, $filename, $filename) ); // more than expected number of arguments - -var_dump( file($filename, "INCORRECT_FLAG", NULL) ); // Incorrect flag var_dump( file($filename, 10, NULL) ); // Incorrect flag var_dump( file("temp.tmp") ); // non existing filename @@ -30,14 +26,6 @@ unlink($file_path."/file.tmp"); ?> --EXPECTF-- *** Testing error conditions *** -Warning: file() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: file() expects at most 3 parameters, 4 given in %s on line %d -NULL - -Warning: file() expects parameter 2 to be int, string given in %s on line %d -NULL array(0) { } diff --git a/ext/standard/tests/file/file_get_contents_error.phpt b/ext/standard/tests/file/file_get_contents_error.phpt index f06628f516..6677d78866 100644 --- a/ext/standard/tests/file/file_get_contents_error.phpt +++ b/ext/standard/tests/file/file_get_contents_error.phpt @@ -17,14 +17,8 @@ include($file_path."/file.inc"); echo "\n-- Testing with Non-existing file --\n"; print( file_get_contents("/no/such/file/or/dir") ); -echo "\n-- Testing No.of arguments less than expected --\n"; -print( file_get_contents() ); - -echo "\n-- Testing No.of arguments greater than expected --\n"; - create_files($file_path, 1, "text", 0755, 100, "w", "file", 1, "byte"); $file_handle = fopen($file_path."/file_put_contents_error.tmp", "w"); -print( file_get_contents($file_path."/file1.tmp", false, $file_handle, 1, 2, "extra_argument") ); echo "\n-- Testing for invalid negative maxlen values --"; var_dump( file_get_contents($file_path."/file1.tmp", FALSE, $file_handle, 0, -5) ); @@ -52,14 +46,6 @@ if(file_exists($file_path."/file_put_contents1.tmp")) { Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d --- Testing No.of arguments less than expected -- - -Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d - --- Testing No.of arguments greater than expected -- - -Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d - -- Testing for invalid negative maxlen values -- Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d bool(false) diff --git a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt index b2a09798e3..23c33b60d3 100644 --- a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt +++ b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt @@ -18,15 +18,7 @@ $file_path = dirname(__FILE__); echo "\n-- Testing with Non-existing file --\n"; print( file_get_contents("/no/such/file/or/dir") ); -echo "\n-- Testing No.of arguments less than expected --\n"; -print( file_get_contents() ); -print( file_put_contents() ); -print( file_put_contents($file_path."/".__FILE__) ); - $file_handle = fopen($file_path."/file_put_contents.tmp", "w"); -echo "\n-- Testing No.of arguments greater than expected --\n"; -print( file_put_contents("abc.tmp", 12345, 1, $file_handle, "extra_argument") ); -print( file_get_contents("abc.tmp", false, $file_handle, 1, 2, "extra_argument") ); echo "\n-- Testing for invalid negative maxlen values --"; file_put_contents($file_path."/file_put_contents1.tmp", "Garbage data in the file"); @@ -50,20 +42,6 @@ unlink($file_path."/file_put_contents1.tmp"); Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d --- Testing No.of arguments less than expected -- - -Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d - -Warning: file_put_contents() expects at least 2 parameters, 0 given in %s on line %d - -Warning: file_put_contents() expects at least 2 parameters, 1 given in %s on line %d - --- Testing No.of arguments greater than expected -- - -Warning: file_put_contents() expects at most 4 parameters, 5 given in %s on line %d - -Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d - -- Testing for invalid negative maxlen values -- Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d bool(false) diff --git a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt index 4928404098..25060ea0cf 100644 --- a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt @@ -38,7 +38,11 @@ $names_arr = array( foreach($names_arr as $key =>$value) { echo "\n-- Filename: $key --\n"; - var_dump(file_get_contents($value)); + try { + var_dump(file_get_contents($value)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } ?> @@ -77,14 +81,10 @@ Warning: file_get_contents( ): failed to open stream: Permission denied in %s on bool(false) -- Filename: \0 -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, string given -- Filename: array() -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/file_get_contents_variation8.phpt b/ext/standard/tests/file/file_get_contents_variation8.phpt index 97a3495d54..f826ad60c2 100644 --- a/ext/standard/tests/file/file_get_contents_variation8.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8.phpt @@ -37,7 +37,11 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - var_dump(file_get_contents($names_arr[$i])); + try { + var_dump(file_get_contents($names_arr[$i])); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } echo "\n*** Done ***\n"; @@ -69,13 +73,9 @@ bool(false) Warning: file_get_contents( ): failed to open stream: No such file or directory in %s on line %d bool(false) -- Iteration 6 -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, array given -- Iteration 8 -- Warning: file_get_contents(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/file_put_contents_variation2.phpt b/ext/standard/tests/file/file_put_contents_variation2.phpt index ae56486d5f..5e18ce1948 100644 --- a/ext/standard/tests/file/file_put_contents_variation2.phpt +++ b/ext/standard/tests/file/file_put_contents_variation2.phpt @@ -13,8 +13,8 @@ Dave Kelsey <d_kelsey@uk.ibm.com> echo "*** Testing file_put_contents() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt index 095980b536..4c03581c48 100644 --- a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt @@ -35,14 +35,18 @@ $names_arr = array( ); foreach($names_arr as $key =>$value) { - echo "\n-- Filename: $key --\n"; - $res = file_put_contents($value, "Some data"); - if ($res !== false && $res != null) { - echo "$res bytes written to: $value\n"; - unlink($value); - } else { - echo "Failed to write data to: $key\n"; - } + echo "\n-- Filename: $key --\n"; + try { + $res = file_put_contents($value, "Some data"); + if ($res !== false && $res != null) { + echo "$res bytes written to: $value\n"; + unlink($value); + } else { + echo "Failed to write data to: $key\n"; + } + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> @@ -77,14 +81,10 @@ Warning: file_put_contents( ): failed to open stream: Permission denied in %s on Failed to write data to: " " -- Filename: \0 -- - -Warning: file_put_contents() expects parameter 1 to be a valid path, string given in %s on line %d -Failed to write data to: \0 +file_put_contents() expects parameter 1 to be a valid path, string given -- Filename: array() -- - -Warning: file_put_contents() expects parameter 1 to be a valid path, array given in %s on line %d -Failed to write data to: array() +file_put_contents() expects parameter 1 to be a valid path, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/file_put_contents_variation8.phpt b/ext/standard/tests/file/file_put_contents_variation8.phpt Binary files differindex 4aef0644f9..76b7b6f5c6 100644 --- a/ext/standard/tests/file/file_put_contents_variation8.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8.phpt diff --git a/ext/standard/tests/file/filegroup_error.phpt b/ext/standard/tests/file/filegroup_error.phpt index e32711cd5b..e602f3441f 100644 --- a/ext/standard/tests/file/filegroup_error.phpt +++ b/ext/standard/tests/file/filegroup_error.phpt @@ -15,10 +15,6 @@ var_dump( filegroup("/no/such/file/dir") ); var_dump( filegroup("string") ); var_dump( filegroup(100) ); -/* Invalid no.of arguments */ -var_dump( filegroup() ); // args < expected -var_dump( filegroup("/no/such/file", "root") ); // args > expected - echo "\n*** Done ***\n"; ?> --EXPECTF-- @@ -33,10 +29,4 @@ bool(false) Warning: filegroup(): stat failed for 100 in %s on line %d bool(false) -Warning: filegroup() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filegroup() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/filegroup_variation2.phpt b/ext/standard/tests/file/filegroup_variation2.phpt index 809d61ba73..46a3dc9f35 100644 --- a/ext/standard/tests/file/filegroup_variation2.phpt +++ b/ext/standard/tests/file/filegroup_variation2.phpt @@ -11,7 +11,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> /* Testing filegroup() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/filegroup_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -22,7 +21,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -34,7 +32,6 @@ foreach( $filenames as $filename ) { var_dump( filegroup($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -58,9 +55,6 @@ bool(false) bool(false) bool(false) -Warning: filegroup() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: filegroup(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/filegroup_variation3.phpt b/ext/standard/tests/file/filegroup_variation3.phpt index ebefeb7e3f..a0d4b2fdee 100644 --- a/ext/standard/tests/file/filegroup_variation3.phpt +++ b/ext/standard/tests/file/filegroup_variation3.phpt @@ -39,7 +39,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( filegroup( $file_path."/".$file ) ); + try { + var_dump( filegroup( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -74,12 +78,8 @@ bool(false) Warning: filegroup(): stat failed for %s/filegroup_variation3/filegroup*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +filegroup() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +filegroup() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/fileinode_error.phpt b/ext/standard/tests/file/fileinode_error.phpt index 462ab62367..d080467f04 100644 --- a/ext/standard/tests/file/fileinode_error.phpt +++ b/ext/standard/tests/file/fileinode_error.phpt @@ -16,12 +16,6 @@ var_dump( fileinode("/no/such/file/dir") ); var_dump( fileinode("string") ); var_dump( fileinode(100) ); -/* No.of arguments less than expected */ -var_dump( fileinode() ); - -/* No.of arguments greater than expected */ -var_dump( fileinode(__FILE__, "string") ); - echo "\n*** Done ***"; --EXPECTF-- *** Testing error conditions of fileinode() *** @@ -34,10 +28,4 @@ bool(false) Warning: fileinode(): stat failed for 100 in %s on line 14 bool(false) -Warning: fileinode() expects exactly 1 parameter, 0 given in %s on line 17 -NULL - -Warning: fileinode() expects exactly 1 parameter, 2 given in %s on line 20 -NULL - *** Done *** diff --git a/ext/standard/tests/file/fileinode_variation2.phpt b/ext/standard/tests/file/fileinode_variation2.phpt index 90c7eb19e3..d6397d33b8 100644 --- a/ext/standard/tests/file/fileinode_variation2.phpt +++ b/ext/standard/tests/file/fileinode_variation2.phpt @@ -12,7 +12,6 @@ Description: Returns the inode number of the file, or FALSE in case of an error. /* Testing fileinode() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/fileinode_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -23,7 +22,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -35,7 +33,6 @@ foreach( $filenames as $filename ) { var_dump( fileinode($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -59,9 +56,6 @@ bool(false) bool(false) bool(false) -Warning: fileinode() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: fileinode(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileinode_variation3.phpt b/ext/standard/tests/file/fileinode_variation3.phpt index 2f51e8f595..e50fcfb767 100644 --- a/ext/standard/tests/file/fileinode_variation3.phpt +++ b/ext/standard/tests/file/fileinode_variation3.phpt @@ -40,7 +40,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( fileinode( $file_path."/".$file ) ); + try { + var_dump( fileinode( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -75,12 +79,8 @@ bool(false) Warning: fileinode(): stat failed for %s/fileinode_variation3/fileinode*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileinode() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileinode() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/fileowner_error.phpt b/ext/standard/tests/file/fileowner_error.phpt index 967a541cc0..807c09f0f0 100644 --- a/ext/standard/tests/file/fileowner_error.phpt +++ b/ext/standard/tests/file/fileowner_error.phpt @@ -15,10 +15,6 @@ var_dump( fileowner("/no/such/file/dir") ); var_dump( fileowner("string") ); var_dump( fileowner(100) ); -/* Invalid no.of arguments */ -var_dump( fileowner() ); // args < expected -var_dump( fileowner("/no/such/file", "root") ); // args > expected - echo "\n*** Done ***\n"; ?> --EXPECTF-- @@ -33,10 +29,4 @@ bool(false) Warning: fileowner(): stat failed for 100 in %s on line %d bool(false) -Warning: fileowner() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: fileowner() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/fileowner_variation2.phpt b/ext/standard/tests/file/fileowner_variation2.phpt index 131d43bfaa..f6741cb9ca 100644 --- a/ext/standard/tests/file/fileowner_variation2.phpt +++ b/ext/standard/tests/file/fileowner_variation2.phpt @@ -12,7 +12,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> /* Testing fileowner() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/fileowner_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -23,7 +22,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -35,7 +33,6 @@ foreach( $filenames as $filename ) { var_dump( fileowner($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -59,9 +56,6 @@ bool(false) bool(false) bool(false) -Warning: fileowner() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: fileowner(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileowner_variation3.phpt b/ext/standard/tests/file/fileowner_variation3.phpt index 5768f528f1..6a2953aa6c 100644 --- a/ext/standard/tests/file/fileowner_variation3.phpt +++ b/ext/standard/tests/file/fileowner_variation3.phpt @@ -40,7 +40,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( fileowner( $file_path."/".$file ) ); + try { + var_dump( fileowner( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -75,12 +79,8 @@ bool(false) Warning: fileowner(): stat failed for %s/fileowner_variation3/fileowner*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: fileowner() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileowner() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: fileowner() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileowner() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/fileperms_variation2.phpt b/ext/standard/tests/file/fileperms_variation2.phpt index 6b1778e74e..b2b8a19859 100644 --- a/ext/standard/tests/file/fileperms_variation2.phpt +++ b/ext/standard/tests/file/fileperms_variation2.phpt @@ -11,7 +11,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> /* Testing fileperms() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/fileperms_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -22,7 +21,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -34,7 +32,6 @@ foreach( $filenames as $filename ) { var_dump( fileperms($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -58,9 +55,6 @@ bool(false) bool(false) bool(false) -Warning: fileperms() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: fileperms(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileperms_variation3.phpt b/ext/standard/tests/file/fileperms_variation3.phpt index 6ae97d1601..5b1160019a 100644 --- a/ext/standard/tests/file/fileperms_variation3.phpt +++ b/ext/standard/tests/file/fileperms_variation3.phpt @@ -39,7 +39,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( fileperms( $file_path."/".$file ) ); + try { + var_dump( fileperms( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -74,12 +78,8 @@ bool(false) Warning: fileperms(): stat failed for %s/fileperms_variation3/fileperms*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: fileperms() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileperms() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: fileperms() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileperms() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/filesize_error.phpt b/ext/standard/tests/file/filesize_error.phpt index 9f721ff921..5ad8ee99ca 100644 --- a/ext/standard/tests/file/filesize_error.phpt +++ b/ext/standard/tests/file/filesize_error.phpt @@ -14,13 +14,6 @@ echo "*** Testing filesize(): error conditions ***"; var_dump( filesize("/no/such/file") ); var_dump( filesize("/no/such/dir") ); -/* No.of arguments less than expected */ -var_dump( filesize() ); - -/* No.of arguments greater than expected */ -var_dump( filesize(__FILE__, 2000) ); -echo "\n"; - echo "*** Done ***\n"; ?> --EXPECTF-- @@ -30,11 +23,4 @@ bool(false) Warning: filesize(): stat failed for /no/such/dir in %s on line %d bool(false) - -Warning: filesize() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filesize() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/filetype_error.phpt b/ext/standard/tests/file/filetype_error.phpt index b49a5286c6..a34671d9b0 100644 --- a/ext/standard/tests/file/filetype_error.phpt +++ b/ext/standard/tests/file/filetype_error.phpt @@ -16,12 +16,6 @@ print( filetype("/no/such/file/dir") ); print( filetype("string") ); print( filetype(100) ); -/* No.of args less than expected */ -print( filetype() ); - -/* No.of args greater than expected */ -print( filetype("file", "file") ); - echo "\n*** Done ***\n"; ?> --EXPECTF-- @@ -32,8 +26,4 @@ Warning: filetype(): Lstat failed for string in %s on line %d Warning: filetype(): Lstat failed for 100 in %s on line %d -Warning: filetype() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: filetype() expects exactly 1 parameter, 2 given in %s on line %d - *** Done *** diff --git a/ext/standard/tests/file/flock.phpt b/ext/standard/tests/file/flock.phpt index 2330270113..4c3cb45c06 100644 --- a/ext/standard/tests/file/flock.phpt +++ b/ext/standard/tests/file/flock.phpt @@ -5,9 +5,6 @@ flock() tests $file = dirname(__FILE__)."/flock.dat"; -var_dump(flock()); -var_dump(flock("", "", $var)); - $fp = fopen($file, "w"); fclose($fp); @@ -41,12 +38,6 @@ $file = dirname(__FILE__)."/flock.dat"; unlink($file); ?> --EXPECTF-- -Warning: flock() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: flock() expects parameter 1 to be resource, string given in %s on line %d -NULL - Warning: flock(): supplied resource is not a valid stream resource in %s on line %d bool(false) bool(true) diff --git a/ext/standard/tests/file/flock_error.phpt b/ext/standard/tests/file/flock_error.phpt index ccb6274756..0e3f1d949c 100644 --- a/ext/standard/tests/file/flock_error.phpt +++ b/ext/standard/tests/file/flock_error.phpt @@ -29,7 +29,11 @@ $operations = array( $i = 0; foreach($operations as $operation) { echo "\n--- Iteration $i ---"; - var_dump(flock($fp, $operation)); + try { + var_dump(flock($fp, $operation)); + } catch (TypeError $e) { + echo "\n", $e->getMessage(), "\n"; + } $i++; } @@ -39,15 +43,6 @@ $fp = fopen($file, "w"); fclose($fp); var_dump(flock($fp, LOCK_SH|LOCK_NB)); -var_dump(flock("", "", $var)); - -/* No.of args leass than expected */ -var_dump(flock()); -var_dump(flock($fp)); - -/* No.of args greater than expected */ -var_dump(flock($fp, "", $var, "")); - echo "\n*** Done ***\n"; ?> --CLEAN-- @@ -75,38 +70,21 @@ Warning: flock(): Illegal operation argument in %s on line %d bool(false) --- Iteration 4 --- -Warning: flock() expects parameter 2 to be int, array given in %s on line %d -NULL +flock() expects parameter 2 to be int, array given --- Iteration 5 --- -Warning: flock() expects parameter 2 to be int, array given in %s on line %d -NULL +flock() expects parameter 2 to be int, array given --- Iteration 6 --- -Warning: flock() expects parameter 2 to be int, string given in %s on line %d -NULL +flock() expects parameter 2 to be int, string given --- Iteration 7 --- -Warning: flock() expects parameter 2 to be int, string given in %s on line %d -NULL +flock() expects parameter 2 to be int, string given --- Iteration 8 --- -Warning: flock() expects parameter 2 to be int, string given in %s on line %d -NULL +flock() expects parameter 2 to be int, string given Warning: flock(): supplied resource is not a valid stream resource in %s on line %d bool(false) -Warning: flock() expects parameter 1 to be resource, string given in %s on line %d -NULL - -Warning: flock() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: flock() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: flock() expects at most 3 parameters, 4 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt index b3607be58b..048eb1475c 100644 --- a/ext/standard/tests/file/fnmatch_variation.phpt +++ b/ext/standard/tests/file/fnmatch_variation.phpt @@ -66,7 +66,11 @@ $pattern_arr = array( for( $i = 0; $i<count($pattern_arr); $i++ ) { echo "-- Iteration $i --\n"; - var_dump( fnmatch($pattern_arr[$i], $file_name) ); + try { + var_dump( fnmatch($pattern_arr[$i], $file_name) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } unlink($file_name); @@ -78,7 +82,11 @@ function match( $pattern, $string ) { for( $i = 0; $i<count($pattern); $i++ ) { echo "-- Iteration $i --\n"; for( $j = 0; $j<count($string); $j++ ) { - var_dump( fnmatch($pattern[$i], $string[$j]) ); + try { + var_dump( fnmatch($pattern[$i], $string[$j]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } } } @@ -134,7 +142,7 @@ match($null_arr, $null_arr); echo "\n*** Done ***\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing fnmatch() with file and various patterns *** -- Iteration 0 -- bool(true) @@ -183,13 +191,9 @@ bool(false) -- Iteration 22 -- bool(false) -- Iteration 23 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 24 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 25 -- bool(false) -- Iteration 26 -- @@ -263,84 +267,44 @@ bool(true) --- With Strings --- -- Iteration 0 -- bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) -- Iteration 1 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 2 -- bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) -- Iteration 3 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 4 -- bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) bool(false) -- Iteration 5 -- bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) @@ -441,64 +405,42 @@ bool(true) bool(true) bool(true) bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(false) -- Iteration 1 -- bool(true) bool(true) bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(false) -- Iteration 2 -- bool(true) bool(true) bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(false) -- Iteration 3 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 4 -- bool(false) bool(false) bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) bool(false) -- Iteration 5 -- bool(false) bool(false) bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) diff --git a/ext/standard/tests/file/fread_error.phpt b/ext/standard/tests/file/fread_error.phpt index 1c4068cd97..f51f24c754 100644 --- a/ext/standard/tests/file/fread_error.phpt +++ b/ext/standard/tests/file/fread_error.phpt @@ -14,14 +14,6 @@ echo "*** Testing error conditions ***\n"; $filename = __FILE__; $file_handle = fopen($filename, "r"); -// zero argument -echo "-- Testing fread() with zero argument --\n"; -var_dump( fread() ); - -// more than expected no. of args -echo "-- Testing fread() with more than expected number of arguments --\n"; -var_dump( fread($file_handle, 10, $file_handle) ); - // invalid length argument echo "-- Testing fread() with invalid length arguments --\n"; $len = 0; @@ -29,44 +21,9 @@ var_dump( fread($file_handle, $len) ); $len = -10; var_dump( fread($file_handle, $len) ); -// test invalid arguments : non-resources -echo "-- Testing fread() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fread() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fread($invalid_args[$loop_counter - 1], 10) ); -} - -// fwrite() on a file handle which is already closed -echo "-- Testing fwrite() with closed/unset file handle --\n"; -fclose($file_handle); -var_dump( fread($file_handle,$file_content_type) ); - -// fwrite on a file handle which is unset -$fp = fopen($filename, "r"); -unset($fp); //unset file handle -var_dump( fread(@$fp,10) ); -var_dump( fclose(@$fp) ); - echo "Done\n"; --EXPECTF-- *** Testing error conditions *** --- Testing fread() with zero argument -- - -Warning: fread() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) --- Testing fread() with more than expected number of arguments -- - -Warning: fread() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) -- Testing fread() with invalid length arguments -- Warning: fread(): Length parameter must be greater than 0 in %s on line %d @@ -74,41 +31,4 @@ bool(false) Warning: fread(): Length parameter must be greater than 0 in %s on line %d bool(false) --- Testing fread() with invalid arguments -- --- Iteration 1 -- - -Warning: fread() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fread() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fread() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fread() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fread() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fread() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Testing fwrite() with closed/unset file handle -- - -Notice: Undefined variable: file_content_type in %s on line %d - -Warning: fread(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fread() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fscanf.phpt b/ext/standard/tests/file/fscanf.phpt index 6d3d0a5b96..7e40d20b48 100644 --- a/ext/standard/tests/file/fscanf.phpt +++ b/ext/standard/tests/file/fscanf.phpt @@ -5,10 +5,6 @@ fscanf() tests $filename = dirname(__FILE__)."/fscanf.dat"; -var_dump(fscanf()); -var_dump(fscanf(array())); -var_dump(fscanf(array(), array())); - file_put_contents($filename, "data"); $fp = fopen($filename, "rt"); @@ -64,14 +60,6 @@ $filename = dirname(__FILE__)."/fscanf.dat"; unlink($filename); ?> --EXPECTF-- -Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: fscanf() expects parameter 1 to be resource, array given in %s on line %d -NULL int(0) NULL int(1) diff --git a/ext/standard/tests/file/fscanf_error.phpt b/ext/standard/tests/file/fscanf_error.phpt index db2a881d6c..d5b2ba73aa 100644 --- a/ext/standard/tests/file/fscanf_error.phpt +++ b/ext/standard/tests/file/fscanf_error.phpt @@ -17,16 +17,6 @@ if ($file_handle == false) fwrite($file_handle, "hello world"); fclose($file_handle); -// zero argument -var_dump( fscanf() ); - -// single argument -$file_handle = fopen($filename, 'r'); -if ($file_handle == false) - exit("Error:failed to open file $filename"); -var_dump( fscanf($file_handle) ); -fclose($file_handle); - // invalid file handle var_dump( fscanf($file_handle, "%s") ); @@ -38,7 +28,7 @@ var_dump( fscanf($file_handle, "%d%s%f", $int_var, $string_var) ); fclose($file_handle); // different invalid format strings -$invalid_formats = array( $undefined_var, undefined_constant, +$invalid_formats = array( $undefined_var, "%", "%h", "%.", "%d%m" ); @@ -63,12 +53,6 @@ unlink($filename); --EXPECTF-- *** Testing fscanf() for error conditions *** -Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d -NULL - Warning: fscanf(): supplied resource is not a valid File-Handle resource in %s on line %d bool(false) @@ -76,10 +60,6 @@ Warning: fscanf(): Different numbers of variable names and field specifiers in % int(-1) Notice: Undefined variable: undefined_var in %s on line %d - -Warning: Use of undefined constant undefined_constant - assumed 'undefined_constant' (this will throw an Error in a future version of PHP) in %s on line %d -array(0) { -} array(0) { } diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt index 9c1b3a822d..c39b3bcbe5 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt @@ -14,86 +14,18 @@ Test fseek(), ftell() & rewind() functions : error conditions - fseek() */ echo "*** Testing fseek() : error conditions ***\n"; -// zero argument -echo "-- Testing fseek() with zero argument --\n"; -var_dump( fseek() ); - -// unexpected no. of args -echo "-- Testing fseek() with unexpected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( fseek($fp) ); -var_dump( fseek($fp, 10, $fp,10) ); - -// test invalid arguments : non-resources -echo "-- Testing fseek() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass -); -/* loop to test fseek() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fseek($invalid_args[$loop_counter - 1], 10) ); -} // fseek() on a file handle which is already closed echo "-- Testing fseek() with closed/unset file handle --"; +$fp = fopen(__FILE__, "r"); fclose($fp); var_dump(fseek($fp,10)); -// fseek() on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( fseek(@$file_handle,10)); - echo "Done\n"; ?> --EXPECTF-- *** Testing fseek() : error conditions *** --- Testing fseek() with zero argument -- - -Warning: fseek() expects at least 2 parameters, 0 given in %s on line %d -bool(false) --- Testing fseek() with unexpected number of arguments -- - -Warning: fseek() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: fseek() expects at most 3 parameters, 4 given in %s on line %d -bool(false) --- Testing fseek() with invalid arguments -- --- Iteration 1 -- - -Warning: fseek() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fseek() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fseek() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fseek() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fseek() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fseek() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing fseek() with closed/unset file handle -- Warning: fseek(): supplied resource is not a valid stream resource in %s on line %d bool(false) - -Warning: fseek() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt index 8835046f6c..87f70b8717 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt @@ -14,82 +14,18 @@ Test fseek(), ftell() & rewind() functions : error conditions - ftell() */ echo "*** Testing ftell() : error conditions ***\n"; -// zero argument -echo "-- Testing ftell() with zero argument --\n"; -var_dump( ftell() ); - -// more than expected no. of args -echo "-- Testing ftell() with more than expected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( ftell($fp, 10) ); - -// test invalid arguments : non-resources -echo "-- Testing ftell() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test ftell with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( ftell($invalid_args[$loop_counter - 1]) ); -} // ftell on a file handle which is already closed echo "-- Testing ftell with closed/unset file handle --"; +$fp = fopen(__FILE__, "r"); fclose($fp); var_dump(ftell($fp)); -// ftell on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( ftell(@$file_handle) ); - echo "Done\n"; ?> --EXPECTF-- *** Testing ftell() : error conditions *** --- Testing ftell() with zero argument -- - -Warning: ftell() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) --- Testing ftell() with more than expected number of arguments -- - -Warning: ftell() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) --- Testing ftell() with invalid arguments -- --- Iteration 1 -- - -Warning: ftell() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: ftell() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: ftell() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: ftell() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: ftell() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: ftell() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing ftell with closed/unset file handle -- Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d bool(false) - -Warning: ftell() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt index 0b94bcffc7..edbb9e22f2 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt @@ -14,82 +14,18 @@ Test fseek(), ftell() & rewind() functions : error conditions - rewind() */ echo "*** Testing rewind() : error conditions ***\n"; -// zero argument -echo "-- Testing rewind() with zero argument --\n"; -var_dump( rewind() ); - -// more than expected no. of args -echo "-- Testing rewind() with more than expected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( rewind($fp, 10) ); - -// test invalid arguments : non-resources -echo "-- Testing rewind() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test rewind with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( rewind($invalid_args[$loop_counter - 1]) ); -} // rewind on a file handle which is already closed echo "-- Testing rewind() with closed/unset file handle --"; +$fp = fopen(__FILE__, "r"); fclose($fp); var_dump(rewind($fp)); -// rewind on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( rewind(@$file_handle) ); - echo "Done\n"; ?> --EXPECTF-- *** Testing rewind() : error conditions *** --- Testing rewind() with zero argument -- - -Warning: rewind() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) --- Testing rewind() with more than expected number of arguments -- - -Warning: rewind() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) --- Testing rewind() with invalid arguments -- --- Iteration 1 -- - -Warning: rewind() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: rewind() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: rewind() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: rewind() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: rewind() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: rewind() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing rewind() with closed/unset file handle -- Warning: rewind(): supplied resource is not a valid stream resource in %s on line %d bool(false) - -Warning: rewind() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/ftruncate_error.phpt b/ext/standard/tests/file/ftruncate_error.phpt index 3cb6db27f8..ecbdeddf06 100644 --- a/ext/standard/tests/file/ftruncate_error.phpt +++ b/ext/standard/tests/file/ftruncate_error.phpt @@ -15,38 +15,6 @@ fwrite($file_handle, "Testing ftruncate error conditions \n"); fflush($file_handle); echo "\n Initial file size = ".filesize($filename)."\n"; -echo "-- Testing ftruncate() with less than expected number of arguments --\n"; - -// zero arguments -var_dump( ftruncate() ); - -// arguments less than expected numbers -var_dump( ftruncate( $file_handle ) ); -// check the first size -var_dump( filesize($filename) ); - -echo "-- Testing ftruncate() with more than expected number of arguments --\n"; -// more than expected number of arguments -var_dump( ftruncate($file_handle, 10, 20) ); -// check the first size -var_dump( filesize($filename) ); - -// test invalid arguments : non-resources -echo "-- Testing ftruncate() with invalid file pointer --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test ftruncate() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( ftruncate($invalid_args[$loop_counter - 1], 10) ); -} - // ftruncate() on a file handle which is already closed/unset echo "-- Testing ftruncate() with closed/unset file handle --\n"; @@ -56,13 +24,6 @@ var_dump( ftruncate($file_handle,10) ); // check the first size var_dump( filesize($filename) ); -// ftruncate on a file handle which is unset -$fp = fopen($filename, "w"); -unset($fp); //unset file handle -var_dump( ftruncate(@$fp,10)); -// check the first size -var_dump( filesize($filename) ); - echo "Done\n"; ?> --CLEAN-- @@ -74,51 +35,9 @@ unlink( $filename ); *** Testing ftruncate() : error conditions *** Initial file size = 36 --- Testing ftruncate() with less than expected number of arguments -- - -Warning: ftruncate() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: ftruncate() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) -int(36) --- Testing ftruncate() with more than expected number of arguments -- - -Warning: ftruncate() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) -int(36) --- Testing ftruncate() with invalid file pointer -- --- Iteration 1 -- - -Warning: ftruncate() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: ftruncate() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: ftruncate() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: ftruncate() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: ftruncate() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: ftruncate() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing ftruncate() with closed/unset file handle -- Warning: ftruncate(): supplied resource is not a valid stream resource in %s on line %d bool(false) int(36) - -Warning: ftruncate() expects parameter 1 to be resource, null given in %s on line %d -bool(false) -int(36) Done diff --git a/ext/standard/tests/file/fwrite.phpt b/ext/standard/tests/file/fwrite.phpt index 443710b99d..195d3afe77 100644 --- a/ext/standard/tests/file/fwrite.phpt +++ b/ext/standard/tests/file/fwrite.phpt @@ -6,8 +6,7 @@ fwrite() tests $filename = dirname(__FILE__)."/fwrite.dat"; $fp = fopen($filename, "w"); -var_dump(fwrite($fp)); -var_dump(fwrite($fp, array())); +var_dump(fwrite($fp, "")); fclose($fp); $fp = fopen($filename, "r"); @@ -20,33 +19,16 @@ fclose($fp); var_dump(fwrite($fp, "data", -1)); -var_dump(fwrite(array(), "data", -1)); -var_dump(fwrite(array(), "data")); -var_dump(fwrite(array())); - var_dump(file_get_contents($filename)); @unlink($filename); echo "Done\n"; ?> --EXPECTF-- -Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: fwrite() expects parameter 2 to be string, array given in %s on line %d -bool(false) +int(0) int(0) int(0) int(4) int(0) - -Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d -bool(false) string(4) "data" Done diff --git a/ext/standard/tests/file/fwrite_error.phpt b/ext/standard/tests/file/fwrite_error.phpt index f4f691be35..a52d2dd003 100644 --- a/ext/standard/tests/file/fwrite_error.phpt +++ b/ext/standard/tests/file/fwrite_error.phpt @@ -16,18 +16,8 @@ include ("file.inc"); echo "*** Testing fwrite() : error conditions ***\n"; $filename = dirname(__FILE__)."/fwrite_error.tmp"; - -echo "-- Testing fwrite() with less than expected number of arguments --\n"; -// zero argument -var_dump( fwrite() ); -// less than expected, 1 arg $file_handle = fopen ( $filename, "w"); -var_dump( fwrite($file_handle) ); - -// more than expected no. of args -echo "-- Testing fwrite() with more than expected number of arguments --\n"; $data = "data"; -var_dump( fwrite($file_handle, $data, strlen($data), 10) ); // invalid length argument echo "-- Testing fwrite() with invalid length arguments --\n"; @@ -36,32 +26,11 @@ var_dump( fwrite($file_handle, $data, $len) ); $len = -10; var_dump( fwrite($file_handle, $data, $len) ); -// test invalid arguments : non-resources -echo "-- Testing fwrite() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fwrite() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fwrite($invalid_args[$loop_counter - 1], 10) ); -} - // fwrite() on a file handle which is already closed echo "-- Testing fwrite() with closed/unset file handle --\n"; fclose($file_handle); var_dump(fwrite($file_handle,"data")); -// fwrite on a file handle which is unset -$fp = fopen($filename, "w"); -unset($fp); //unset file handle -var_dump( fwrite(@$fp,"data")); - echo "Done\n"; ?> --CLEAN-- @@ -71,50 +40,11 @@ unlink( $filename ); ?> --EXPECTF-- *** Testing fwrite() : error conditions *** --- Testing fwrite() with less than expected number of arguments -- - -Warning: fwrite() expects at least 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d -bool(false) --- Testing fwrite() with more than expected number of arguments -- - -Warning: fwrite() expects at most 3 parameters, 4 given in %s on line %d -bool(false) -- Testing fwrite() with invalid length arguments -- int(0) int(0) --- Testing fwrite() with invalid arguments -- --- Iteration 1 -- - -Warning: fwrite() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fwrite() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fwrite() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fwrite() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fwrite() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing fwrite() with closed/unset file handle -- Warning: fwrite(): supplied resource is not a valid stream resource in %s on line %d bool(false) - -Warning: fwrite() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/get_current_user.phpt b/ext/standard/tests/file/get_current_user.phpt index f23d2fabef..04938e3d6b 100644 --- a/ext/standard/tests/file/get_current_user.phpt +++ b/ext/standard/tests/file/get_current_user.phpt @@ -3,13 +3,10 @@ get_current_user() tests --FILE-- <?php -var_dump(get_current_user("blah")); var_dump(get_current_user()); echo "Done\n"; ?> --EXPECTF-- -Warning: get_current_user() expects exactly 0 parameters, 1 given in %s on line %d -NULL string(%d) %s Done diff --git a/ext/standard/tests/file/glob_variation-win32-mb.phpt b/ext/standard/tests/file/glob_variation-win32-mb.phpt index cba2e2b343..8d1ae00c34 100644 --- a/ext/standard/tests/file/glob_variation-win32-mb.phpt +++ b/ext/standard/tests/file/glob_variation-win32-mb.phpt @@ -46,12 +46,16 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "\n-- Iteration $counter --\n"; - var_dump( glob($pattern) ); // default arguments - var_dump( glob($pattern, GLOB_MARK) ); - var_dump( glob($pattern, GLOB_NOSORT) ); - var_dump( glob($pattern, GLOB_NOCHECK) ); - var_dump( glob($pattern, GLOB_NOESCAPE) ); - var_dump( glob($pattern, GLOB_ERR) ); + try { + var_dump( glob($pattern) ); // default arguments + var_dump( glob($pattern, GLOB_MARK) ); + var_dump( glob($pattern, GLOB_NOSORT) ); + var_dump( glob($pattern, GLOB_NOCHECK) ); + var_dump( glob($pattern, GLOB_NOESCAPE) ); + var_dump( glob($pattern, GLOB_ERR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -73,7 +77,11 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; - var_dump( glob($pattern, GLOB_ONLYDIR) ); + try { + var_dump( glob($pattern, GLOB_ONLYDIR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -326,24 +334,7 @@ array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { @@ -446,9 +437,7 @@ array(1) { array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %sglob_variation-win32-mb.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/glob_variation-win32.phpt b/ext/standard/tests/file/glob_variation-win32.phpt index 5027ac03e6..2706377d8c 100644 --- a/ext/standard/tests/file/glob_variation-win32.phpt +++ b/ext/standard/tests/file/glob_variation-win32.phpt @@ -45,12 +45,16 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "\n-- Iteration $counter --\n"; - var_dump( glob($pattern) ); // default arguments - var_dump( glob($pattern, GLOB_MARK) ); - var_dump( glob($pattern, GLOB_NOSORT) ); - var_dump( glob($pattern, GLOB_NOCHECK) ); - var_dump( glob($pattern, GLOB_NOESCAPE) ); - var_dump( glob($pattern, GLOB_ERR) ); + try { + var_dump( glob($pattern) ); // default arguments + var_dump( glob($pattern, GLOB_MARK) ); + var_dump( glob($pattern, GLOB_NOSORT) ); + var_dump( glob($pattern, GLOB_NOCHECK) ); + var_dump( glob($pattern, GLOB_NOESCAPE) ); + var_dump( glob($pattern, GLOB_ERR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -72,7 +76,11 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; - var_dump( glob($pattern, GLOB_ONLYDIR) ); + try { + var_dump( glob($pattern, GLOB_ONLYDIR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -325,24 +333,7 @@ array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { @@ -445,9 +436,7 @@ array(1) { array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %sglob_variation-win32.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/glob_variation.phpt b/ext/standard/tests/file/glob_variation.phpt index 9d3b879379..3c20a49b31 100644 --- a/ext/standard/tests/file/glob_variation.phpt +++ b/ext/standard/tests/file/glob_variation.phpt @@ -48,12 +48,16 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "\n-- Iteration $counter --\n"; - var_dump( glob($pattern) ); // default arguments - var_dump( glob($pattern, GLOB_MARK) ); - var_dump( glob($pattern, GLOB_NOSORT) ); - var_dump( glob($pattern, GLOB_NOCHECK) ); - var_dump( glob($pattern, GLOB_NOESCAPE) ); - var_dump( glob($pattern, GLOB_ERR) ); + try { + var_dump( glob($pattern) ); // default arguments + var_dump( glob($pattern, GLOB_MARK) ); + var_dump( glob($pattern, GLOB_NOSORT) ); + var_dump( glob($pattern, GLOB_NOCHECK) ); + var_dump( glob($pattern, GLOB_NOESCAPE) ); + var_dump( glob($pattern, GLOB_ERR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -75,7 +79,11 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; - var_dump( glob($pattern, GLOB_ONLYDIR) ); + try { + var_dump( glob($pattern, GLOB_ONLYDIR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -328,24 +336,7 @@ array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { @@ -448,9 +439,7 @@ array(1) { array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/is_dir_variation3.phpt b/ext/standard/tests/file/is_dir_variation3.phpt index c1664165eb..060739ff3d 100644 --- a/ext/standard/tests/file/is_dir_variation3.phpt +++ b/ext/standard/tests/file/is_dir_variation3.phpt @@ -9,8 +9,6 @@ Test is_dir() function: usage variations - invalid arguments /* Passing invalid arguments to is_dir() */ -$dir_handle = opendir( dirname(__FILE__) ); - echo "*** Testing is_dir() with Invalid arguments: expected bool(false) ***\n"; $dirnames = array( /* Invalid dirnames */ @@ -19,7 +17,6 @@ $dirnames = array( FALSE, NULL, " ", - $dir_handle, /* scalars */ 0, @@ -30,7 +27,6 @@ $dirnames = array( foreach($dirnames as $dirname) { var_dump( is_dir($dirname) ); } -closedir($dir_handle); echo "\n*** Done ***"; ?> @@ -41,9 +37,6 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_dir() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL bool(false) bool(false) diff --git a/ext/standard/tests/file/is_dir_variation4.phpt b/ext/standard/tests/file/is_dir_variation4.phpt index 5c0be485c5..3c3d0852ef 100644 --- a/ext/standard/tests/file/is_dir_variation4.phpt +++ b/ext/standard/tests/file/is_dir_variation4.phpt @@ -38,7 +38,11 @@ $count = 1; /* loop through to test each element the above array */ foreach($dirs_arr as $dir) { echo "\n-- Iteration $count --\n"; - var_dump( is_dir($file_path."/".$dir ) ); + try { + var_dump( is_dir($file_path."/".$dir ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } @@ -77,13 +81,9 @@ bool(true) bool(false) -- Iteration 9 -- - -Warning: is_dir() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_dir() expects parameter 1 to be a valid path, string given -- Iteration 10 -- - -Warning: is_dir() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_dir() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/is_executable_error.phpt b/ext/standard/tests/file/is_executable_error.phpt index 4fb3dbaf5f..e4b43095e3 100644 --- a/ext/standard/tests/file/is_executable_error.phpt +++ b/ext/standard/tests/file/is_executable_error.phpt @@ -6,24 +6,11 @@ Test is_executable() function: error conditions Description: Tells whether the filename is executable */ -echo "*** Testing is_executable(): error conditions ***\n"; -var_dump( is_executable() ); // args < expected no of arguments - -var_dump( is_executable(1, 2) ); // args > expected no. of arguments - echo "\n*** Testing is_exceutable() on non-existent directory ***\n"; var_dump( is_executable(dirname(__FILE__)."/is_executable") ); echo "Done\n"; --EXPECTF-- -*** Testing is_executable(): error conditions *** - -Warning: is_executable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_executable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing is_exceutable() on non-existent directory *** bool(false) Done diff --git a/ext/standard/tests/file/is_executable_variation1.phpt b/ext/standard/tests/file/is_executable_variation1.phpt index 1cd0a8d209..784685705b 100644 --- a/ext/standard/tests/file/is_executable_variation1.phpt +++ b/ext/standard/tests/file/is_executable_variation1.phpt @@ -51,7 +51,11 @@ $counter = 1; is an executable file */ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; - var_dump( is_executable($file) ); + try { + var_dump( is_executable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; clearstatcache(); } @@ -76,13 +80,9 @@ bool(false) -- Iteration 5 -- bool(false) -- Iteration 6 -- - -Warning: is_executable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_executable() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: is_executable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_executable() expects parameter 1 to be a valid path, string given -- Iteration 8 -- bool(false) -- Iteration 9 -- diff --git a/ext/standard/tests/file/is_executable_variation3.phpt b/ext/standard/tests/file/is_executable_variation3.phpt index a804f66eb2..637bbacd67 100644 --- a/ext/standard/tests/file/is_executable_variation3.phpt +++ b/ext/standard/tests/file/is_executable_variation3.phpt @@ -38,7 +38,6 @@ $invalid_files = array( FALSE, NULL, " ", - @array(), @$file_handle ); /* loop through to test each element in the above array @@ -61,8 +60,5 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_executable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL bool(false) Done diff --git a/ext/standard/tests/file/is_file_variation3.phpt b/ext/standard/tests/file/is_file_variation3.phpt index ec70371417..1b94594faa 100644 --- a/ext/standard/tests/file/is_file_variation3.phpt +++ b/ext/standard/tests/file/is_file_variation3.phpt @@ -21,7 +21,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -50,9 +49,6 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_file() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL bool(false) bool(false) diff --git a/ext/standard/tests/file/is_file_variation4.phpt b/ext/standard/tests/file/is_file_variation4.phpt index 505331d2c9..689ae1098f 100644 --- a/ext/standard/tests/file/is_file_variation4.phpt +++ b/ext/standard/tests/file/is_file_variation4.phpt @@ -38,7 +38,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( is_file( $file_path."/".$file ) ); + try { + var_dump( is_file( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -67,12 +71,8 @@ bool(false) - Iteration 6 - bool(false) - Iteration 7 - - -Warning: is_file() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_file() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: is_file() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_file() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/is_readable_error.phpt b/ext/standard/tests/file/is_readable_error.phpt index 9a734cd14d..8a4b507b6f 100644 --- a/ext/standard/tests/file/is_readable_error.phpt +++ b/ext/standard/tests/file/is_readable_error.phpt @@ -6,24 +6,12 @@ Test is_readable() function: error conditions Description: Tells whether the filename is readable */ -echo "*** Testing is_readable(): error conditions ***\n"; -var_dump( is_readable() ); // args < expected -var_dump( is_readable(1, 2) ); // args > expected - echo "\n*** Testing is_readable() on non-existent file ***\n"; var_dump( is_readable(dirname(__FILE__)."/is_readable.tmp") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing is_readable(): error conditions *** - -Warning: is_readable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_readable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing is_readable() on non-existent file *** bool(false) Done diff --git a/ext/standard/tests/file/is_readable_variation1.phpt b/ext/standard/tests/file/is_readable_variation1.phpt index 0ba2324f9a..b6570fb911 100644 --- a/ext/standard/tests/file/is_readable_variation1.phpt +++ b/ext/standard/tests/file/is_readable_variation1.phpt @@ -60,7 +60,11 @@ $counter = 1; is a writable file */ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; - var_dump( is_readable($file) ); + try { + var_dump( is_readable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; clearstatcache(); } @@ -87,17 +91,11 @@ bool(false) -- Iteration 6 -- bool(false) -- Iteration 7 -- - -Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_readable() expects parameter 1 to be a valid path, string given -- Iteration 8 -- - -Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_readable() expects parameter 1 to be a valid path, string given -- Iteration 9 -- - -Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_readable() expects parameter 1 to be a valid path, string given -- Iteration 10 -- bool(true) -- Iteration 11 -- diff --git a/ext/standard/tests/file/is_readable_variation3.phpt b/ext/standard/tests/file/is_readable_variation3.phpt index 74fc7af574..48b4e30386 100644 --- a/ext/standard/tests/file/is_readable_variation3.phpt +++ b/ext/standard/tests/file/is_readable_variation3.phpt @@ -37,7 +37,6 @@ $misc_files = array( FALSE, NULL, " ", - @array(), @$file_handle ); /* loop through to test each element in the above array @@ -60,8 +59,5 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_readable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL bool(false) Done diff --git a/ext/standard/tests/file/is_uploaded_file_basic.phpt b/ext/standard/tests/file/is_uploaded_file_basic.phpt index 1721935549..d053244a79 100644 --- a/ext/standard/tests/file/is_uploaded_file_basic.phpt +++ b/ext/standard/tests/file/is_uploaded_file_basic.phpt @@ -29,19 +29,9 @@ var_dump(is_uploaded_file('random_filename.txt')); // not an uploaded file var_dump(is_uploaded_file('__FILE__')); -// Error cases -var_dump(is_uploaded_file()); -var_dump(is_uploaded_file('a', 'b')); - ?> --EXPECTF-- bool(true) bool(false) bool(false) bool(false) - -Warning: is_uploaded_file() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_uploaded_file() expects exactly 1 parameter, 2 given in %s on line %d -NULL diff --git a/ext/standard/tests/file/is_writable_error.phpt b/ext/standard/tests/file/is_writable_error.phpt index e3755bc748..e1641e0e9f 100644 --- a/ext/standard/tests/file/is_writable_error.phpt +++ b/ext/standard/tests/file/is_writable_error.phpt @@ -8,14 +8,6 @@ Test is_writable() and its alias is_writeable() function: error conditions is_writeable() is an alias of is_writable() */ -echo "*** Testing is_writable(): error conditions ***\n"; -var_dump( is_writable() ); // args < expected -var_dump( is_writeable() ); - -echo "\n*** Testing is_writeable(): error conditions ***\n"; -var_dump( is_writable(1, 2) ); // args > expected -var_dump( is_writeable(1, 2) ); - echo "\n*** Testing is_writable() on non-existent file ***\n"; var_dump( is_writable(dirname(__FILE__)."/is_writable") ); var_dump( is_writeable(dirname(__FILE__)."/is_writable") ); @@ -23,22 +15,6 @@ var_dump( is_writeable(dirname(__FILE__)."/is_writable") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing is_writable(): error conditions *** - -Warning: is_writable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_writeable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -*** Testing is_writeable(): error conditions *** - -Warning: is_writable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: is_writeable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing is_writable() on non-existent file *** bool(false) bool(false) diff --git a/ext/standard/tests/file/is_writable_variation1.phpt b/ext/standard/tests/file/is_writable_variation1.phpt index f5cdf6a8a0..ec9756fbf1 100644 --- a/ext/standard/tests/file/is_writable_variation1.phpt +++ b/ext/standard/tests/file/is_writable_variation1.phpt @@ -62,8 +62,16 @@ $counter = 1; is a writable file */ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; - var_dump( is_writable($file) ); - var_dump( is_writeable($file) ); + try { + var_dump( is_writable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( is_writeable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; clearstatcache(); } @@ -96,26 +104,14 @@ bool(false) bool(false) bool(false) -- Iteration 7 -- - -Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_writable() expects parameter 1 to be a valid path, string given +is_writeable() expects parameter 1 to be a valid path, string given -- Iteration 8 -- - -Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_writable() expects parameter 1 to be a valid path, string given +is_writeable() expects parameter 1 to be a valid path, string given -- Iteration 9 -- - -Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_writable() expects parameter 1 to be a valid path, string given +is_writeable() expects parameter 1 to be a valid path, string given -- Iteration 10 -- bool(true) bool(true) diff --git a/ext/standard/tests/file/is_writable_variation3.phpt b/ext/standard/tests/file/is_writable_variation3.phpt index 3cc7a4da9d..d533a2745d 100644 --- a/ext/standard/tests/file/is_writable_variation3.phpt +++ b/ext/standard/tests/file/is_writable_variation3.phpt @@ -35,7 +35,6 @@ $misc_files = array( FALSE, NULL, " ", - @array(), @$file_handle ); /* loop through to test each element in the above array @@ -66,12 +65,6 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_writable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL bool(false) bool(false) Done diff --git a/ext/standard/tests/file/lchown_error.phpt b/ext/standard/tests/file/lchown_error.phpt index f4b4f5089e..18e0407fdc 100644 --- a/ext/standard/tests/file/lchown_error.phpt +++ b/ext/standard/tests/file/lchown_error.phpt @@ -29,20 +29,9 @@ $filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchown.txt'; touch( $filename ); $uid = posix_getuid(); - -// Less than expected arguments -var_dump( lchown( $filename ) ); - -// More than expected arguments -var_dump( lchown( $filename, $uid, 'foobar' ) ); - // Non-existent filename var_dump( lchown( 'foobar_lchown.txt', $uid ) ); -// Wrong argument types -var_dump( lchown( new StdClass(), $uid ) ); -var_dump( lchown( array(), $uid ) ); - // Bad user var_dump( lchown( $filename, -5 ) ); @@ -58,21 +47,9 @@ unlink($filename); --EXPECTF-- *** Testing lchown() : error functionality *** -Warning: lchown() expects exactly 2 parameters, 1 given in %s on line %d -bool(true) - -Warning: lchown() expects exactly 2 parameters, 3 given in %s on line %d -bool(true) - Warning: lchown(): No such file or directory in %s on line %d bool(false) -Warning: lchown() expects parameter 1 to be a valid path, object given in %s on line %d -bool(true) - -Warning: lchown() expects parameter 1 to be a valid path, array given in %s on line %d -bool(true) - Warning: lchown(): %r(Operation not permitted|Invalid argument)%r in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/file/lstat_stat_error.phpt b/ext/standard/tests/file/lstat_stat_error.phpt index 8f290a32e3..e6fccd5acc 100644 --- a/ext/standard/tests/file/lstat_stat_error.phpt +++ b/ext/standard/tests/file/lstat_stat_error.phpt @@ -17,54 +17,28 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { echo "*** Testing lstat() for error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( lstat() ); // args < expected -var_dump( lstat(__FILE__, 2) ); // args > expected var_dump( lstat("$file_path/temp.tmp") ); // non existing file var_dump( lstat(22) ); // scalar argument -$arr = array(__FILE__); -var_dump( lstat($arr) ); // array argument echo "\n*** Testing stat() for error conditions ***\n"; -var_dump( stat() ); // args < expected -var_dump( stat(__FILE__, 2) ); // file, args > expected -var_dump( stat(dirname(__FILE__), 2) ); //dir, args > expected var_dump( stat("$file_path/temp.tmp") ); // non existing file var_dump( stat("$file_path/temp/") ); // non existing dir var_dump( stat(22) ); // scalar argument -var_dump( stat($arr) ); // array argument echo "Done\n"; ?> --EXPECTF-- *** Testing lstat() for error conditions *** -Warning: lstat() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: lstat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: lstat(): Lstat failed for %s in %s on line %d bool(false) Warning: lstat(): Lstat failed for 22 in %s on line %d bool(false) -Warning: lstat() expects parameter 1 to be a valid path, array given in %s on line %d -NULL - *** Testing stat() for error conditions *** -Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: stat(): stat failed for %s in %s on line %d bool(false) @@ -73,7 +47,4 @@ bool(false) Warning: stat(): stat failed for 22 in %s on line %d bool(false) - -Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d -NULL Done diff --git a/ext/standard/tests/file/mkdir_rmdir_error.phpt b/ext/standard/tests/file/mkdir_rmdir_error.phpt index 17f908c3f6..be0b434c2c 100644 --- a/ext/standard/tests/file/mkdir_rmdir_error.phpt +++ b/ext/standard/tests/file/mkdir_rmdir_error.phpt @@ -9,48 +9,12 @@ Test mkdir() and rmdir() functions : error conditions Description: Removes directory */ -echo "*** Testing mkdir(): error conditions ***\n"; -var_dump( mkdir() ); // args < expected -var_dump( mkdir(1, 2, 3, 4, 5) ); // args > expected -var_dump( mkdir("testdir", 0777, false, $context, "test") ); // args > expected - -echo "\n*** Testing rmdir(): error conditions ***\n"; -var_dump( rmdir() ); // args < expected -var_dump( rmdir(1, 2, 3) ); // args > expected -var_dump( rmdir("testdir", $context, "test") ); // args > expected - echo "\n*** Testing rmdir() on non-existent directory ***\n"; var_dump( rmdir("temp") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing mkdir(): error conditions *** - -Warning: mkdir() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d -bool(false) - -Notice: Undefined variable: context in %s on line %d - -Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d -bool(false) - -*** Testing rmdir(): error conditions *** - -Warning: rmdir() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - -Notice: Undefined variable: context in %s on line %d - -Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - *** Testing rmdir() on non-existent directory *** Warning: rmdir(temp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt index 24dfc96ac9..0af1055178 100644 --- a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt +++ b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt @@ -35,8 +35,16 @@ var_dump( mkdir("$file_path/mkdir_variation2/test/", 0777, true) ); var_dump( rmdir("$file_path/mkdir_variation2/") ); echo "\n*** Testing mkdir() and rmdir() for binary safe functionality ***\n"; -var_dump( mkdir("$file_path/temp".chr(0)."/") ); -var_dump( rmdir("$file_path/temp".chr(0)."/") ); +try { + var_dump( mkdir("$file_path/temp".chr(0)."/") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( rmdir("$file_path/temp".chr(0)."/") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n*** Testing mkdir() with miscelleneous input ***\n"; /* changing mode of mkdir to prevent creating sub-directory under it */ @@ -64,12 +72,8 @@ Warning: rmdir(%s/mkdir_variation2/): %s on line %d bool(false) *** Testing mkdir() and rmdir() for binary safe functionality *** - -Warning: mkdir() expects parameter 1 to be a valid path, string given in %s on line %d -bool(false) - -Warning: rmdir() expects parameter 1 to be a valid path, string given in %s on line %d -bool(false) +mkdir() expects parameter 1 to be a valid path, string given +rmdir() expects parameter 1 to be a valid path, string given *** Testing mkdir() with miscelleneous input *** bool(true) diff --git a/ext/standard/tests/file/move_uploaded_file_basic.phpt b/ext/standard/tests/file/move_uploaded_file_basic.phpt index c6cfdd3203..7af8748fe2 100644 --- a/ext/standard/tests/file/move_uploaded_file_basic.phpt +++ b/ext/standard/tests/file/move_uploaded_file_basic.phpt @@ -49,11 +49,6 @@ fclose($fd); var_dump(move_uploaded_file($_FILES['file2']['tmp_name'], $destination4)); unlink($destination4); -echo "Wrong parameters\n"; -var_dump(move_uploaded_file()); -var_dump(move_uploaded_file(1, 2, 3)); - - ?> --EXPECTF-- Valid move @@ -66,10 +61,3 @@ Non-uploaded source file bool(false) Valid move to existing file bool(true) -Wrong parameters - -Warning: move_uploaded_file() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: move_uploaded_file() expects exactly 2 parameters, 3 given in %s on line %d -NULL diff --git a/ext/standard/tests/file/parse_ini_file_error.phpt b/ext/standard/tests/file/parse_ini_file_error.phpt index 29e022fb13..5c812d7b9a 100644 --- a/ext/standard/tests/file/parse_ini_file_error.phpt +++ b/ext/standard/tests/file/parse_ini_file_error.phpt @@ -10,10 +10,6 @@ Test parse_ini_file() function : error conditions echo "*** Testing parse_ini_file() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing parse_ini_file() function with Zero arguments --\n"; -var_dump( parse_ini_file() ); - //Test parse_ini_file with one more than the expected number of arguments echo "\n-- Testing parse_ini_file() function with more than expected no. of arguments --\n"; $filename = 'string_val'; @@ -30,11 +26,6 @@ echo "Done"; --EXPECTF-- *** Testing parse_ini_file() : error conditions *** --- Testing parse_ini_file() function with Zero arguments -- - -Warning: parse_ini_file() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -- Testing parse_ini_file() function with more than expected no. of arguments -- Warning: parse_ini_file(%s): failed to open stream: No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/parse_ini_file_variation3.phpt b/ext/standard/tests/file/parse_ini_file_variation3.phpt index 96d44433f7..acdb4d83eb 100644 --- a/ext/standard/tests/file/parse_ini_file_variation3.phpt +++ b/ext/standard/tests/file/parse_ini_file_variation3.phpt @@ -43,7 +43,6 @@ log_errors_max_len = 1024 ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On -track_errors = Off docref_root = "/phpmanual/" docref_ext = .html @@ -77,7 +76,7 @@ foreach($newdirs as $newdir) { --EXPECTF-- *** Testing parse_ini_file() : variation *** New include path is : %sparse_ini_file_variation3.dir1%sparse_ini_file_variation3.dir2%sparse_ini_file_variation3.dir3%S -array(11) { +array(10) { ["error_reporting"]=> string(5) "32767" ["display_errors"]=> @@ -94,8 +93,6 @@ array(11) { string(0) "" ["report_memleaks"]=> string(1) "1" - ["track_errors"]=> - string(0) "" ["docref_root"]=> string(11) "/phpmanual/" ["docref_ext"]=> diff --git a/ext/standard/tests/file/pathinfo_variaton.phpt b/ext/standard/tests/file/pathinfo_variaton.phpt index 421f378e01..6f4492e375 100644 --- a/ext/standard/tests/file/pathinfo_variaton.phpt +++ b/ext/standard/tests/file/pathinfo_variaton.phpt @@ -43,9 +43,6 @@ $paths = array ( "./array(1, 2)", "array( array(), null)", - /* pathname as object */ - $obj, - /* pathname as spaces */ " ", ' ', @@ -199,22 +196,6 @@ string(21) "array( array(), null)" string(0) "" string(21) "array( array(), null)" -- Iteration 9 -- - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL --- Iteration 10 -- array(3) { ["dirname"]=> string(1) "." @@ -227,7 +208,7 @@ string(1) "." string(1) " " string(0) "" string(1) " " --- Iteration 11 -- +-- Iteration 10 -- array(3) { ["dirname"]=> string(1) "." @@ -240,7 +221,7 @@ string(1) "." string(1) " " string(0) "" string(1) " " --- Iteration 12 -- +-- Iteration 11 -- array(2) { ["basename"]=> string(0) "" @@ -251,7 +232,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 13 -- +-- Iteration 12 -- array(2) { ["basename"]=> string(0) "" @@ -262,7 +243,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 14 -- +-- Iteration 13 -- array(2) { ["basename"]=> string(0) "" @@ -273,7 +254,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 15 -- +-- Iteration 14 -- array(2) { ["basename"]=> string(0) "" @@ -284,7 +265,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 16 -- +-- Iteration 15 -- array(2) { ["basename"]=> string(0) "" @@ -295,7 +276,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 17 -- +-- Iteration 16 -- array(4) { ["dirname"]=> string(1) "." @@ -310,7 +291,7 @@ string(1) "." string(11) "www.foo.com" string(3) "com" string(7) "www.foo" --- Iteration 18 -- +-- Iteration 17 -- array(4) { ["dirname"]=> string(17) "/var/html/testdir" @@ -325,7 +306,7 @@ string(17) "/var/html/testdir" string(12) "example.html" string(4) "html" string(7) "example" --- Iteration 19 -- +-- Iteration 18 -- array(3) { ["dirname"]=> string(12) "/testdir/foo" @@ -338,7 +319,7 @@ string(12) "/testdir/foo" string(4) "test" string(0) "" string(4) "test" --- Iteration 20 -- +-- Iteration 19 -- array(4) { ["dirname"]=> string(4) "/foo" @@ -353,7 +334,7 @@ string(4) "/foo" string(12) "symlink.link" string(4) "link" string(7) "symlink" --- Iteration 21 -- +-- Iteration 20 -- array(3) { ["dirname"]=> string(1) "." @@ -366,7 +347,7 @@ string(1) "." string(5) "12345" string(0) "" string(5) "12345" --- Iteration 22 -- +-- Iteration 21 -- array(4) { ["dirname"]=> string(1) "." @@ -381,7 +362,7 @@ string(1) "." string(15) "www.example.com" string(3) "com" string(11) "www.example" --- Iteration 23 -- +-- Iteration 22 -- array(3) { ["dirname"]=> string(12) "/testdir/foo" @@ -394,7 +375,7 @@ string(12) "/testdir/foo" string(4) "test" string(0) "" string(4) "test" --- Iteration 24 -- +-- Iteration 23 -- array(4) { ["dirname"]=> string(6) "../foo" @@ -409,7 +390,7 @@ string(6) "../foo" string(9) "test.link" string(4) "link" string(4) "test" --- Iteration 25 -- +-- Iteration 24 -- array(4) { ["dirname"]=> string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/test5/test6" @@ -424,7 +405,7 @@ string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/tes string(8) "test.tmp" string(3) "tmp" string(4) "test" --- Iteration 26 -- +-- Iteration 25 -- array(4) { ["dirname"]=> string(1) "." diff --git a/ext/standard/tests/file/popen_pclose_error.phpt b/ext/standard/tests/file/popen_pclose_error.phpt index 93ed5d946e..22fe309741 100644 --- a/ext/standard/tests/file/popen_pclose_error.phpt +++ b/ext/standard/tests/file/popen_pclose_error.phpt @@ -16,14 +16,9 @@ if (strtoupper( substr(PHP_OS, 0, 3) ) == 'SUN') */ $file_path = dirname(__FILE__); echo "*** Testing for error conditions ***\n"; -var_dump( popen() ); // Zero Arguments -var_dump( popen("abc.txt") ); // Single Argument var_dump( popen("abc.txt", "rw") ); // Invalid mode Argument -var_dump( pclose() ); $file_handle = fopen($file_path."/popen.tmp", "w"); -var_dump( pclose($file_handle, $file_handle) ); fclose($file_handle); -var_dump( pclose(1) ); echo "\n--- Done ---"; ?> --CLEAN-- @@ -34,22 +29,7 @@ unlink($file_path."/popen.tmp"); --EXPECTF-- *** Testing for error conditions *** -Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: popen(abc.txt,rw): %s on line %d bool(false) -Warning: pclose() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: pclose() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: pclose() expects parameter 1 to be resource, int given in %s on line %d -bool(false) - --- Done --- diff --git a/ext/standard/tests/file/readfile_error.phpt b/ext/standard/tests/file/readfile_error.phpt index fcaa7f3946..c74b63d0d6 100644 --- a/ext/standard/tests/file/readfile_error.phpt +++ b/ext/standard/tests/file/readfile_error.phpt @@ -9,17 +9,12 @@ Test readfile() function: error conditions $context = stream_context_create(); echo "*** Test readfile(): error conditions ***\n"; -echo "-- Testing readfile() with unexpected no. of arguments --\n"; -var_dump( readfile() ); // args < expected -var_dump( readfile(__FILE__, true, $context, 4) ); // args > expected echo "\n-- Testing readfile() with invalid arguments --\n"; // invalid arguments var_dump( readfile(NULL) ); // NULL as $filename var_dump( readfile('') ); // empty string as $filename var_dump( readfile(false) ); // boolean false as $filename -var_dump( readfile(__FILE__, false, '') ); // empty string as $context -var_dump( readfile(__FILE__, true, false) ); // boolean false as $context echo "\n-- Testing readfile() with non-existent file --\n"; $non_existent_file = dirname(__FILE__)."/non_existent_file.tmp"; @@ -29,13 +24,6 @@ echo "Done\n"; ?> --EXPECTF-- *** Test readfile(): error conditions *** --- Testing readfile() with unexpected no. of arguments -- - -Warning: readfile() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: readfile() expects at most 3 parameters, 4 given in %s on line %d -bool(false) -- Testing readfile() with invalid arguments -- @@ -48,12 +36,6 @@ bool(false) Warning: readfile(): Filename cannot be empty in %s on line %d bool(false) -Warning: readfile() expects parameter 3 to be resource, string given in %s on line %d -bool(false) - -Warning: readfile() expects parameter 3 to be resource, bool given in %s on line %d -bool(false) - -- Testing readfile() with non-existent file -- Warning: readfile(%s/non_existent_file.tmp): failed to open stream: %s in %s on line %d diff --git a/ext/standard/tests/file/readfile_variation10-win32.phpt b/ext/standard/tests/file/readfile_variation10-win32.phpt index a240a826b9..04fdafca79 100644 --- a/ext/standard/tests/file/readfile_variation10-win32.phpt +++ b/ext/standard/tests/file/readfile_variation10-win32.phpt @@ -36,8 +36,12 @@ $names_arr = array( ); foreach($names_arr as $key => $value) { - echo "\n-- Filename: $key --\n"; - readfile($value); + echo "\n-- Filename: $key --\n"; + try { + readfile($value); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> @@ -70,12 +74,10 @@ Warning: readfile(): Filename cannot be empty in %s on line %d Warning: readfile( ): failed to open stream: Permission denied in %s on line %d -- Filename: \0 -- - -Warning: readfile() expects parameter 1 to be a valid path, string given in %s on line %d +readfile() expects parameter 1 to be a valid path, string given -- Filename: array() -- - -Warning: readfile() expects parameter 1 to be a valid path, array given in %s on line %d +readfile() expects parameter 1 to be a valid path, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/readfile_variation10.phpt b/ext/standard/tests/file/readfile_variation10.phpt Binary files differindex 59b92ad365..5a0070c04f 100644 --- a/ext/standard/tests/file/readfile_variation10.phpt +++ b/ext/standard/tests/file/readfile_variation10.phpt diff --git a/ext/standard/tests/file/readlink_realpath_error.phpt b/ext/standard/tests/file/readlink_realpath_error.phpt index dc042bfff5..f7fd340aab 100644 --- a/ext/standard/tests/file/readlink_realpath_error.phpt +++ b/ext/standard/tests/file/readlink_realpath_error.phpt @@ -15,10 +15,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { Description: Returns canonicalized absolute pathname */ -echo "*** Testing readlink(): error conditions ***\n"; -var_dump( readlink() ); // args < expected -var_dump( readlink(__FILE__, 2) ); // args > expected - echo "\n*** Testing readlink() on a non-existent link ***\n"; var_dump( readlink(dirname(__FILE__)."/readlink_error.tmp") ); @@ -28,24 +24,12 @@ var_dump( readlink(__FILE__) ); echo "\n*** Testing readlink() on existing directory ***\n"; var_dump( readlink(dirname(__FILE__)) ); -echo "*** Testing realpath(): error conditions ***\n"; -var_dump( realpath() ); // args < expected -var_dump( realpath(1, 2) ); // args > expected - echo "\n*** Testing realpath() on a non-existent file ***\n"; var_dump( realpath(dirname(__FILE__)."/realpath_error.tmp") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing readlink(): error conditions *** - -Warning: readlink() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: readlink() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing readlink() on a non-existent link *** Warning: readlink(): No such file or directory in %s on line %d @@ -60,13 +44,6 @@ bool(false) Warning: readlink(): Invalid argument in %s on line %d bool(false) -*** Testing realpath(): error conditions *** - -Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d -NULL *** Testing realpath() on a non-existent file *** %s diff --git a/ext/standard/tests/file/readlink_variation1.phpt b/ext/standard/tests/file/readlink_variation1.phpt index c350a94c77..eef16630d2 100644 --- a/ext/standard/tests/file/readlink_variation1.phpt +++ b/ext/standard/tests/file/readlink_variation1.phpt @@ -16,7 +16,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { /* Testing readlink() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/readlink_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -26,7 +25,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -38,7 +36,6 @@ foreach( $filenames as $filename ) { var_dump( readlink($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -65,9 +62,6 @@ bool(false) Warning: readlink(): %s in %s on line %d bool(false) -Warning: readlink() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: readlink(): %s in %s on line %d bool(false) diff --git a/ext/standard/tests/file/realpath_error-win32.phpt b/ext/standard/tests/file/realpath_error-win32.phpt deleted file mode 100644 index 2fd221e45a..0000000000 --- a/ext/standard/tests/file/realpath_error-win32.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Test realpath() function: error conditions ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip only on Windows'); -} -?> ---FILE-- -<?php -/* Prototype: string realpath ( string $path ); - Description: Returns canonicalized absolute pathname -*/ - -echo "*** Testing realpath() for error conditions ***\n"; -var_dump( realpath() ); // args < expected -var_dump( realpath(1, 2) ); // args > expected - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing realpath() for error conditions *** - -Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/file/rename_variation13-win32.phpt b/ext/standard/tests/file/rename_variation13-win32.phpt Binary files differindex 6319d4ad61..977746a21d 100644 --- a/ext/standard/tests/file/rename_variation13-win32.phpt +++ b/ext/standard/tests/file/rename_variation13-win32.phpt diff --git a/ext/standard/tests/file/rename_variation13.phpt b/ext/standard/tests/file/rename_variation13.phpt index 2686150f23..07ee8aa9d8 100644 --- a/ext/standard/tests/file/rename_variation13.phpt +++ b/ext/standard/tests/file/rename_variation13.phpt @@ -30,8 +30,6 @@ $names_arr = array( NULL, "", " ", - "\0", - array(), /* prefix with path separator of a non existing directory*/ "/no/such/file/dir", @@ -97,24 +95,6 @@ bool(true) Warning: rename( ,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d bool(false) --- testing '%s' -- - -Warning: rename() %s in %s on line %d -bool(false) - -Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d - -Warning: rename() expects parameter 1 to be a valid path, string given in %s on line %d -bool(false) --- testing 'Array' -- - -Warning: rename() expects parameter 2 to be a valid path, array given in %s on line %d -bool(false) - -Warning: file_exists() expects parameter 1 to be a valid path, array given in %s on line %d - -Warning: rename() expects parameter 1 to be a valid path, array given in %s on line %d -bool(false) -- testing '/no/such/file/dir' -- Warning: rename(%s/renameVar13/afile.tmp,/no/such/file/dir): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/stat_error-win32.phpt b/ext/standard/tests/file/stat_error-win32.phpt index 20bffc79df..59c4fd6dee 100644 --- a/ext/standard/tests/file/stat_error-win32.phpt +++ b/ext/standard/tests/file/stat_error-win32.phpt @@ -17,29 +17,16 @@ $file_path = dirname(__FILE__); $arr = array(__FILE__); echo "\n*** Testing stat() for error conditions ***\n"; -var_dump( stat() ); // args < expected -var_dump( stat(__FILE__, 2) ); // file, args > expected -var_dump( stat(dirname(__FILE__), 2) ); //dir, args > expected var_dump( stat("$file_path/temp.tmp") ); // non existing file var_dump( stat("$file_path/temp/") ); // non existing dir var_dump( stat(22) ); // scalar argument -var_dump( stat($arr) ); // array argument echo "Done\n"; ?> --EXPECTF-- *** Testing stat() for error conditions *** -Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: stat(): stat failed for %s in %s on line %d bool(false) @@ -48,7 +35,4 @@ bool(false) Warning: stat(): stat failed for 22 in %s on line %d bool(false) - -Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d -NULL Done diff --git a/ext/standard/tests/file/stream_002.phpt b/ext/standard/tests/file/stream_002.phpt index b18dd85b31..84f3b78f06 100644 --- a/ext/standard/tests/file/stream_002.phpt +++ b/ext/standard/tests/file/stream_002.phpt @@ -15,8 +15,6 @@ var_dump(stream_socket_client(".", $a, $b)); var_dump($a, $b); var_dump(stream_socket_client(1, $a, $b)); var_dump($a, $b); -var_dump(stream_socket_client(array(), $a, $b)); -var_dump($a, $b); echo "Done\n"; ?> @@ -45,9 +43,4 @@ Warning: stream_socket_client(): unable to connect to 1 (Failed to parse address bool(false) int(0) string(27) "Failed to parse address "1"" - -Warning: stream_socket_client() expects parameter 1 to be string, array given in %s on line %d -bool(false) -int(0) -string(27) "Failed to parse address "1"" Done diff --git a/ext/standard/tests/file/stream_rfc2397_002.phpt b/ext/standard/tests/file/stream_rfc2397_002.phpt index 1dce5adf6c..6c58d0d7ad 100644 --- a/ext/standard/tests/file/stream_rfc2397_002.phpt +++ b/ext/standard/tests/file/stream_rfc2397_002.phpt @@ -24,9 +24,11 @@ $streams = array( foreach($streams as $stream) { $stream = fopen($stream, 'r'); - $meta = @stream_get_meta_data($stream); - var_dump($meta); - var_dump(isset($meta['foo']) ? $meta['foo'] : null); + if ($stream) { + $meta = stream_get_meta_data($stream); + var_dump($meta); + var_dump(isset($meta['foo']) ? $meta['foo'] : null); + } } ?> @@ -52,8 +54,6 @@ array(7) { NULL Warning: fopen(data://): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d -NULL -NULL array(7) { ["base64"]=> bool(true) @@ -73,16 +73,10 @@ array(7) { NULL Warning: fopen(data://;base64): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d -NULL -NULL Warning: fopen(data://foo,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d -NULL -NULL Warning: fopen(data://foo=bar,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d -NULL -NULL array(8) { ["mediatype"]=> string(10) "text/plain" @@ -104,8 +98,6 @@ array(8) { NULL Warning: fopen(data://text/plain;foo,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d -NULL -NULL array(9) { ["mediatype"]=> string(10) "text/plain" @@ -129,8 +121,6 @@ array(9) { string(3) "bar" Warning: fopen(data://text/plain;foo=bar;bla,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d -NULL -NULL array(9) { ["mediatype"]=> string(10) "text/plain" @@ -154,8 +144,6 @@ array(9) { string(3) "bar" Warning: fopen(data://text/plain;foo=bar;bar=baz): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d -NULL -NULL array(10) { ["mediatype"]=> string(10) "text/plain" diff --git a/ext/standard/tests/file/stream_rfc2397_006.phpt b/ext/standard/tests/file/stream_rfc2397_006.phpt index f6616a0c88..18d1c1b280 100644 --- a/ext/standard/tests/file/stream_rfc2397_006.phpt +++ b/ext/standard/tests/file/stream_rfc2397_006.phpt @@ -14,18 +14,19 @@ $streams = array( foreach($streams as $stream) { - var_dump(file_get_contents($stream)); + try { + var_dump(file_get_contents($stream)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } ?> ===DONE=== <?php exit(0); ?> --EXPECTF-- -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d -NULL - -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, string given +file_get_contents() expects parameter 1 to be a valid path, string given Warning: file_get_contents(data:;base64,#Zm9vYmFyIGZvb2Jhcg==): failed to open stream: rfc2397: unable to decode in %sstream_rfc2397_006.php on line %d bool(false) diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt index 7e8b5b24cf..6a1d026a79 100644 --- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt +++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt @@ -33,11 +33,6 @@ fclose($fp); $linkname = dirname(__FILE__)."/symlink_link_linkinfo_is_link_link_error1.tmp"; echo "*** Testing symlink() for error conditions ***\n"; -//zero arguments -var_dump( symlink() ); - -//more than expected -var_dump( symlink($filename, $linkname, true) ); //invalid arguments var_dump( symlink(NULL, $linkname) ); // NULL as filename @@ -48,11 +43,6 @@ var_dump( symlink($filename, '') ); // '' as linkname var_dump( symlink($filename, false) ); // false as linkname echo "\n*** Testing linkinfo() for error conditions ***\n"; -//zero arguments -var_dump( linkinfo() ); - -//more than expected -var_dump( linkinfo($linkname, true) ); //invalid arguments var_dump( linkinfo(NULL) ); // NULL as linkname @@ -69,12 +59,6 @@ unlink(dirname(__FILE__)."/symlink_link_linkinfo_is_link_error1.tmp"); --EXPECTF-- *** Testing symlink() for error conditions *** -Warning: symlink() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: symlink() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: symlink(): %s in %s on line %d bool(false) @@ -95,12 +79,6 @@ bool(false) *** Testing linkinfo() for error conditions *** -Warning: linkinfo() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: linkinfo() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: linkinfo(): %s in %s on line %d int(-1) diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt index fc891fde7b..00047cde5e 100644 --- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt +++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt @@ -30,11 +30,6 @@ fclose($fp); $linkname = dirname(__FILE__)."/symlink_link_linkinfo_is_link_link_error2.tmp"; echo "*** Testing link() for error conditions ***\n"; -//zero arguments -var_dump( link() ); - -//more than expected -var_dump( link($filename, $linkname, false) ); //invalid arguments var_dump( link(NULL, $linkname) ); // NULL as filename @@ -46,11 +41,6 @@ var_dump( link($filename, '') ); // '' as linkname var_dump( link($filename, false) ); // false as linkname echo "\n*** Testing is_link() for error conditions ***\n"; -//zero arguments -var_dump( is_link() ); - -//more than expected -var_dump( is_link($linkname, "/") ); //invalid arguments var_dump( is_link(NULL) ); // NULL as linkname @@ -68,12 +58,6 @@ unlink(dirname(__FILE__)."/symlink_link_linkinfo_is_link_error2.tmp"); --EXPECTF-- *** Testing link() for error conditions *** -Warning: link() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: link() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: link(): No such file or directory in %s on line %d bool(false) @@ -96,12 +80,6 @@ Warning: link(): No such file or directory in %s on line %d bool(false) *** Testing is_link() for error conditions *** - -Warning: is_link() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_link() expects exactly 1 parameter, 2 given in %s on line %d -NULL bool(false) bool(false) bool(false) diff --git a/ext/standard/tests/file/tempnam_variation3-win32.phpt b/ext/standard/tests/file/tempnam_variation3-win32.phpt index 6d5071b5e5..d7602326d9 100644 --- a/ext/standard/tests/file/tempnam_variation3-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt @@ -59,7 +59,12 @@ $res_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam($file_path, $names_arr[$i]); + try { + $file_name = tempnam($file_path, $names_arr[$i]); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } /* creating the files in existing dir */ if (file_exists($file_name) && !$res_arr[$i]) { @@ -104,14 +109,9 @@ Notice: tempnam(): file created in the system's temporary directory in %stempnam Failed, not created in the correct directory %s vs %s 0 -- Iteration 6 -- - -Warning: tempnam() expects parameter 2 to be a valid path, string given in %stempnam_variation3-win32.php on line 54 -Failed, not created in the correct directory %s vs %sext\standard\tests\file\tempnamVar3 -0 +tempnam() expects parameter 2 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 2 to be a valid path, array given in %s\ext\standard\tests\file\tempnam_variation3-win32.php on line %d -OK +tempnam() expects parameter 2 to be a valid path, array given -- Iteration 8 -- OK -- Iteration 9 -- diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt index 2d95cb0a43..ccbd35084f 100644 --- a/ext/standard/tests/file/tempnam_variation3.phpt +++ b/ext/standard/tests/file/tempnam_variation3.phpt @@ -37,7 +37,12 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam("$file_path", $names_arr[$i]); + try { + $file_name = tempnam("$file_path", $names_arr[$i]); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } /* creating the files in existing dir */ if( file_exists($file_name) ) { @@ -100,17 +105,9 @@ File name is => %s/%s File permissions are => 100600 File created in => directory specified -- Iteration 6 -- - -Warning: tempnam() expects parameter 2 to be a valid path, string given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 2 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 2 to be a valid path, array given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 2 to be a valid path, array given -- Iteration 8 -- File name is => %s/dir%s File permissions are => 100600 diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt index 5bacb5e876..f4b3cf016c 100644 --- a/ext/standard/tests/file/tempnam_variation7-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt @@ -34,7 +34,12 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + try { + $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } if( file_exists($file_name) ){ @@ -95,17 +100,9 @@ File name is => %s%et%s File permissions are => 100666 File created in => temp dir -- Iteration 6 -- - -Warning: tempnam() expects parameter 1 to be a valid path, string given in %stempnam_variation7-win32.php on line %d --- File is not created -- - -Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d +tempnam() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d --- File is not created -- - -Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d +tempnam() expects parameter 1 to be a valid path, array given -- Iteration 8 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt index 9ed84f974a..680e207718 100644 --- a/ext/standard/tests/file/tempnam_variation7.phpt +++ b/ext/standard/tests/file/tempnam_variation7.phpt @@ -35,7 +35,12 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + try { + $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } if( file_exists($file_name) ){ @@ -100,17 +105,9 @@ File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 6 -- - -Warning: tempnam() expects parameter 1 to be a valid path, string given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 1 to be a valid path, array given -- Iteration 8 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d diff --git a/ext/standard/tests/file/touch.phpt b/ext/standard/tests/file/touch.phpt index 42d1fad1e5..119ffd3204 100644 --- a/ext/standard/tests/file/touch.phpt +++ b/ext/standard/tests/file/touch.phpt @@ -13,7 +13,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { // output to linux. This could be a php.net bug on windows or a windows querk. $filename = dirname(__FILE__)."/touch.dat"; -var_dump(touch()); var_dump(touch($filename)); var_dump(filemtime($filename)); @unlink($filename); @@ -39,8 +38,6 @@ var_dump(touch("/no/such/file/or/directory")); echo "Done\n"; ?> --EXPECTF-- -Warning: touch() expects at least 1 parameter, 0 given in %s on line %d -NULL bool(true) int(%d) bool(true) diff --git a/ext/standard/tests/file/touch_error.phpt b/ext/standard/tests/file/touch_error.phpt index 0520055a90..9a4bd01e13 100644 --- a/ext/standard/tests/file/touch_error.phpt +++ b/ext/standard/tests/file/touch_error.phpt @@ -5,17 +5,9 @@ Dave Kelsey <d_kelsey@uk.ibm.com> --FILE-- <?php -var_dump(touch()); -var_dump(touch(1, 2, 3, 4)); var_dump(touch("/no/such/file/or/directory")); ?> --EXPECTF-- -Warning: touch() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - Warning: touch(): Unable to create file /no/such/file/or/directory because No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/unlink_error-win32-mb.phpt b/ext/standard/tests/file/unlink_error-win32-mb.phpt index efd6ee8323..2c81e33b72 100644 --- a/ext/standard/tests/file/unlink_error-win32-mb.phpt +++ b/ext/standard/tests/file/unlink_error-win32-mb.phpt @@ -25,13 +25,6 @@ $context = stream_context_create(); echo "*** Testing unlink() : error conditions ***\n"; -echo "-- Testing unlink() on unexpected no. of arguments --\n"; -// arg < expected -var_dump( unlink() ); -// args > expected -var_dump( unlink($filename, $context, true) ); -var_dump( file_exists($filename) ); // expected: true - echo "\n-- Testing unlink() on invalid arguments --\n"; // invalid arguments var_dump( unlink('') ); // $filename as empty string @@ -43,9 +36,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesnt exist -var_dump( unlink($filename, '') ); // $context as empty string -var_dump( unlink($filename, false) ); // $context as boolean false - echo "\n-- Testing unlink() on non-existent file --\n"; var_dump( unlink(dirname(__FILE__)."/non_existent_file.tmp") ); @@ -68,14 +58,6 @@ rmdir(dirname(__FILE__)."/私はガラスを食べられます"); ?> --EXPECTF-- *** Testing unlink() : error conditions *** --- Testing unlink() on unexpected no. of arguments -- - -Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -bool(true) -- Testing unlink() on invalid arguments -- @@ -91,12 +73,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d -bool(false) - -Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d -bool(false) - -- Testing unlink() on non-existent file -- Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/unlink_error-win32.phpt b/ext/standard/tests/file/unlink_error-win32.phpt index 8dde64cff0..fe165ec8c6 100644 --- a/ext/standard/tests/file/unlink_error-win32.phpt +++ b/ext/standard/tests/file/unlink_error-win32.phpt @@ -23,13 +23,6 @@ $context = stream_context_create(); echo "*** Testing unlink() : error conditions ***\n"; -echo "-- Testing unlink() on unexpected no. of arguments --\n"; -// arg < expected -var_dump( unlink() ); -// args > expected -var_dump( unlink($filename, $context, true) ); -var_dump( file_exists($filename) ); // expected: true - echo "\n-- Testing unlink() on invalid arguments --\n"; // invalid arguments var_dump( unlink('') ); // $filename as empty string @@ -41,9 +34,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesnt exist -var_dump( unlink($filename, '') ); // $context as empty string -var_dump( unlink($filename, false) ); // $context as boolean false - echo "\n-- Testing unlink() on non-existent file --\n"; var_dump( unlink(dirname(__FILE__)."/non_existent_file.tmp") ); @@ -65,14 +55,6 @@ rmdir(dirname(__FILE__)."/unlink_error"); ?> --EXPECTF-- *** Testing unlink() : error conditions *** --- Testing unlink() on unexpected no. of arguments -- - -Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -bool(true) -- Testing unlink() on invalid arguments -- @@ -88,12 +70,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d -bool(false) - -Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d -bool(false) - -- Testing unlink() on non-existent file -- Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/unlink_error.phpt b/ext/standard/tests/file/unlink_error.phpt index f7f8f00847..87b189f3cf 100644 --- a/ext/standard/tests/file/unlink_error.phpt +++ b/ext/standard/tests/file/unlink_error.phpt @@ -23,13 +23,6 @@ $context = stream_context_create(); echo "*** Testing unlink() : error conditions ***\n"; -echo "-- Testing unlink() on unexpected no. of arguments --\n"; -// arg < expected -var_dump( unlink() ); -// args > expected -var_dump( unlink($filename, $context, true) ); -var_dump( file_exists($filename) ); // expected true - echo "\n-- Testing unlink() on invalid arguments --\n"; // invalid arguments var_dump( unlink('') ); // $filename as empty string @@ -41,10 +34,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesnt exist -var_dump( unlink($filename, '') ); // $context as empty string -var_dump( unlink($filename, false) ); // $context as boolean false - - echo "\n-- Testing unlink() on non-existent file --\n"; var_dump( unlink(dirname(__FILE__)."/non_existent_file.tmp") ); @@ -65,14 +54,6 @@ rmdir(dirname(__FILE__)."/unlink_error"); ?> --EXPECTF-- *** Testing unlink() : error conditions *** --- Testing unlink() on unexpected no. of arguments -- - -Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -bool(true) -- Testing unlink() on invalid arguments -- @@ -88,12 +69,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d -bool(false) - -Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d -bool(false) - -- Testing unlink() on non-existent file -- Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d |