diff options
Diffstat (limited to 'ext/standard/tests')
337 files changed, 944 insertions, 5475 deletions
diff --git a/ext/standard/tests/array/005.phpt b/ext/standard/tests/array/005.phpt index c82f5f7fd0..c51e98a67b 100644 --- a/ext/standard/tests/array/005.phpt +++ b/ext/standard/tests/array/005.phpt @@ -33,18 +33,6 @@ $mixed_array = array( /* Testing Error Conditions */ echo "\n*** Testing Error Conditions ***\n"; -/* Zero argument */ -var_dump( array_shift() ); - -/* Scalar argument */ -var_dump( array_shift($number) ); - -/* String argument */ -var_dump( array_shift($str) ); - -/* Invalid Number of arguments */ -var_dump( array_shift($mixed_array[1],$mixed_array[2]) ); - /* Empty Array as argument */ var_dump( array_shift($empty_array) ); @@ -83,18 +71,6 @@ echo"Done"; ?> --EXPECTF-- *** Testing Error Conditions *** - -Warning: array_shift() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_shift() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_shift() expects exactly 1 parameter, 2 given in %s on line %d -NULL NULL *** Testing with various array inputs *** diff --git a/ext/standard/tests/array/009.phpt b/ext/standard/tests/array/009.phpt index 017456917e..c62be0d27c 100644 --- a/ext/standard/tests/array/009.phpt +++ b/ext/standard/tests/array/009.phpt @@ -69,51 +69,6 @@ foreach ($varient_arrays as $sub_array ) { echo "\n"; } -/*test these functions on array which is already unset */ -echo "\n-- Testing variation: when array is unset --\n"; -$unset_array = array (1); -unset($unset_array); - -var_dump( current($unset_array) ); -var_dump( key($unset_array) ); -var_dump( next($unset_array) ); -var_dump( reset($unset_array) ); - - -echo "\n*** Testing error conditions ***\n"; -//Zero argument, expected 1 argument -var_dump( key() ); -var_dump( current() ); -var_dump( reset() ); -var_dump( next() ); - -// args more than expected, expected 1 argument -$temp_array = array(1); -var_dump( key($temp_array, $temp_array) ); -var_dump( current($temp_array, $temp_array) ); -var_dump( reset($temp_array, $temp_array) ); -var_dump( next($temp_array, $temp_array) ); - -// invalid args type, valid argument: array -$int_var = 1; -$float_var = 1.5; -$string = "string"; -var_dump( key($int_var) ); -var_dump( key($float_var) ); -var_dump( key($string) ); - -var_dump( current($int_var) ); -var_dump( current($float_var) ); -var_dump( current($string) ); - -var_dump( next($int_var) ); -var_dump( next($float_var) ); -var_dump( next($string) ); - -var_dump( reset($int_var) ); -var_dump( reset($float_var) ); -var_dump( reset($string) ); - echo "Done\n"; ?> --EXPECTF-- @@ -456,84 +411,4 @@ array(5) { string(4) "zero" } - --- Testing variation: when array is unset -- - -Notice: Undefined variable: unset_array in %s on line %d - -Warning: current() expects parameter 1 to be array, null given in %s on line %d -NULL - -Notice: Undefined variable: unset_array in %s on line %d - -Warning: key() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, null given in %s on line %d -NULL - -*** Testing error conditions *** - -Warning: key() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: current() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: reset() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: next() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: key() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: current() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: reset() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: next() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: key() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: key() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: key() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: current() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: current() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: current() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, string given in %s on line %d -NULL Done diff --git a/ext/standard/tests/array/array_change_key_case_variation.phpt b/ext/standard/tests/array/array_change_key_case_variation.phpt index 3f8d502ffe..f2b185523f 100644 --- a/ext/standard/tests/array/array_change_key_case_variation.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation.phpt @@ -6,13 +6,16 @@ Test array_change_key_case() function - 2 $item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four"); /* use 'case' argument other than CASE_LOWER & CASE_UPPER */ -var_dump(array_change_key_case($item, "CASE_UPPER")); +try { + var_dump(array_change_key_case($item, "CASE_UPPER")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(array_change_key_case($item, 5)); /* when keys are different in terms of only case */ /* should return one value key pair with key being in lowercase */ var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) ); -var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5), "CASE_UPPER" ) ); /* should return one value key pair with key being in uppercase */ var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3), CASE_UPPER ) ); @@ -21,8 +24,7 @@ var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 ) echo "end\n"; ?> --EXPECTF-- -Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d -NULL +array_change_key_case() expects parameter 2 to be int, string given array(4) { ["ONE"]=> int(1) @@ -37,9 +39,6 @@ array(1) { ["one"]=> int(4) } - -Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d -NULL array(1) { ["ONE"]=> int(3) diff --git a/ext/standard/tests/array/array_column_error.phpt b/ext/standard/tests/array/array_column_error.phpt index 26a09aff24..9223248520 100644 --- a/ext/standard/tests/array/array_column_error.phpt +++ b/ext/standard/tests/array/array_column_error.phpt @@ -11,18 +11,6 @@ Test array_column() function: error conditions echo "*** Testing array_column() : error conditions ***\n"; -echo "\n-- Testing array_column() function with Zero arguments --\n"; -var_dump(array_column()); - -echo "\n-- Testing array_column() function with One argument --\n"; -var_dump(array_column(array())); - -echo "\n-- Testing array_column() function with string as first parameter --\n"; -var_dump(array_column('foo', 0)); - -echo "\n-- Testing array_column() function with int as first parameter --\n"; -var_dump(array_column(1, 'foo')); - echo "\n-- Testing array_column() column key parameter should be a string or an integer (testing bool) --\n"; var_dump(array_column(array(), true)); @@ -40,26 +28,6 @@ echo "Done\n"; --EXPECTF-- *** Testing array_column() : error conditions *** --- Testing array_column() function with Zero arguments -- - -Warning: array_column() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing array_column() function with One argument -- - -Warning: array_column() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing array_column() function with string as first parameter -- - -Warning: array_column() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Testing array_column() function with int as first parameter -- - -Warning: array_column() expects parameter 1 to be array, int given in %s on line %d -NULL - -- Testing array_column() column key parameter should be a string or an integer (testing bool) -- Warning: array_column(): The column key should be either a string or an integer in %s on line %d diff --git a/ext/standard/tests/array/array_diff_uassoc_error.phpt b/ext/standard/tests/array/array_diff_uassoc_error.phpt index d90c80f20b..f6c6905780 100644 --- a/ext/standard/tests/array/array_diff_uassoc_error.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_error.phpt @@ -27,36 +27,32 @@ function key_compare_func($a, $b) //Test array_diff_uassoc with one more than the expected number of arguments echo "\n-- Testing array_diff_uassoc() function with more than expected no. of arguments --\n"; -var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) ); -var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) ); +try { + var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_diff_uassoc with one less than the expected number of arguments echo "\n-- Testing array_diff_uassoc() function with less than expected no. of arguments --\n"; var_dump( array_diff_uassoc($array1, $array2) ); -// Testing array_diff_uassoc with no arguments -echo "\n-- Testing array_diff_uassoc() function with no arguments --\n"; -var_dump( array_diff_uassoc() ); ?> ===DONE=== --EXPECTF-- *** Testing array_diff_uassoc() : error conditions *** -- Testing array_diff_uassoc() function with more than expected no. of arguments -- - -Warning: array_diff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: array_diff_uassoc() expects parameter 6 to be a valid callback, array must have exactly two members in %s on line %d -NULL +array_diff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members +array_diff_uassoc() expects parameter 6 to be a valid callback, array must have exactly two members -- Testing array_diff_uassoc() function with less than expected no. of arguments -- Warning: array_diff_uassoc(): at least 3 parameters are required, 2 given in %s on line %d NULL - --- Testing array_diff_uassoc() function with no arguments -- - -Warning: array_diff_uassoc(): at least 3 parameters are required, 0 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation10.phpt b/ext/standard/tests/array/array_diff_ukey_variation10.phpt index 2f07428c05..e80f02629e 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation10.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation10.phpt @@ -14,19 +14,23 @@ $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); $array2 = array("a" => "green", "yellow", "red"); //function name within double quotes -var_dump( array_diff_ukey($array1, $array1, "unknown_function") ); +try { + var_dump( array_diff_ukey($array1, $array1, "unknown_function") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //function name within single quotes -var_dump( array_diff_ukey($array1, $array1, 'unknown_function') ); +try { + var_dump( array_diff_ukey($array1, $array1, 'unknown_function') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_ukey() : usage variation *** - -Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL - -Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL +array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name +array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name ===DONE=== diff --git a/ext/standard/tests/array/array_fill_error.phpt b/ext/standard/tests/array/array_fill_error.phpt index 2fbdb850c3..386404a336 100644 --- a/ext/standard/tests/array/array_fill_error.phpt +++ b/ext/standard/tests/array/array_fill_error.phpt @@ -10,44 +10,16 @@ Test array_fill() function : error conditions echo "*** Testing array_fill() : error conditions ***\n"; -// Zero arguments -echo "-- Testing array_fill() function with Zero arguments --\n"; -var_dump( array_fill() ); - -// More than expected number of arguments -echo "-- Testing array_fill() function with more than expected no. of arguments --\n"; +// calling array_fill with negative values for 'num' parameter $start_key = 0; -$num = 2; -$val = 1; -$extra_arg = 10; -var_dump( array_fill($start_key,$num,$val, $extra_arg) ); - -// Less than the expected number of arguments -echo "-- Testing array_fill() function with less than expected no. of arguments --\n"; -$start_key = 0; -$num = 2; -var_dump( array_fill($start_key,$num) ); - -//calling array_fill with negative values for 'num' parameter $num = -1; +$val = 1; var_dump( array_fill($start_key,$num,$val) ); echo "Done"; ?> --EXPECTF-- *** Testing array_fill() : error conditions *** --- Testing array_fill() function with Zero arguments -- - -Warning: array_fill() expects exactly 3 parameters, 0 given in %s on line %d -NULL --- Testing array_fill() function with more than expected no. of arguments -- - -Warning: array_fill() expects exactly 3 parameters, 4 given in %s on line %d -NULL --- Testing array_fill() function with less than expected no. of arguments -- - -Warning: array_fill() expects exactly 3 parameters, 2 given in %s on line %d -NULL Warning: array_fill(): Number of elements can't be negative in %s on line %d bool(false) diff --git a/ext/standard/tests/array/array_fill_keys.phpt b/ext/standard/tests/array/array_fill_keys.phpt index 12adde72e7..fb222a414b 100644 --- a/ext/standard/tests/array/array_fill_keys.phpt +++ b/ext/standard/tests/array/array_fill_keys.phpt @@ -4,15 +4,12 @@ basic array_fill_keys test precision=14 --FILE-- <?php - var_dump(array_fill_keys('test', 1)); var_dump(array_fill_keys(array(), 1)); var_dump(array_fill_keys(array('foo', 'bar'), NULL)); var_dump(array_fill_keys(array('5', 'foo', 10, 1.23), 123)); var_dump(array_fill_keys(array('test', TRUE, 10, 100), '')); ?> ---EXPECTF-- -Warning: array_fill_keys() expects parameter 1 to be array, string given in %s on line %d -NULL +--EXPECT-- array(0) { } array(2) { diff --git a/ext/standard/tests/array/array_fill_keys_variation3.phpt b/ext/standard/tests/array/array_fill_keys_variation3.phpt index 84cc928cbc..b1abbcfe1b 100644 --- a/ext/standard/tests/array/array_fill_keys_variation3.phpt +++ b/ext/standard/tests/array/array_fill_keys_variation3.phpt @@ -12,33 +12,18 @@ Test array_fill_keys() function : variation of parameter echo "*** Testing array_fill_keys() : parameter variations ***\n"; -$simpleStr = "simple"; $fp = fopen(__FILE__, "r"); -$bool = false; -$float = 2.4; $array = array("one", "two"); -$nullVal = null; - -echo "\n-- Testing array_fill_keys() function with both wrong arguments --\n"; -var_dump( array_fill_keys($bool, $float) ); echo "\n-- Testing array_fill_keys() function with unusual second arguments --\n"; var_dump( array_fill_keys($array, $fp) ); -echo "\n-- Testing array_fill_keys() function with mixed array --\n"; -var_dump( array_fill_keys($nullVal, $simpleStr) ); - fclose($fp); echo "Done"; ?> --EXPECTF-- *** Testing array_fill_keys() : parameter variations *** --- Testing array_fill_keys() function with both wrong arguments -- - -Warning: array_fill_keys() expects parameter 1 to be array, bool given in %sarray_fill_keys_variation3.php on line %d -NULL - -- Testing array_fill_keys() function with unusual second arguments -- array(2) { ["one"]=> @@ -46,9 +31,4 @@ array(2) { ["two"]=> resource(%d) of type (stream) } - --- Testing array_fill_keys() function with mixed array -- - -Warning: array_fill_keys() expects parameter 1 to be array, null given in %sarray_fill_keys_variation3.php on line %d -NULL Done diff --git a/ext/standard/tests/array/array_filter.phpt b/ext/standard/tests/array/array_filter.phpt index ba27a59c96..1488aedd09 100644 --- a/ext/standard/tests/array/array_filter.phpt +++ b/ext/standard/tests/array/array_filter.phpt @@ -26,9 +26,6 @@ var_dump(array_filter($array2, "even")); var_dump(array_filter($array3, "even")); var_dump(array_filter(array())); -var_dump(array_filter(array(), array())); -var_dump(array_filter("", null)); -var_dump(array_filter($array1, 1)); echo '== DONE =='; ?> @@ -81,13 +78,4 @@ array(2) { } array(0) { } - -Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL == DONE == diff --git a/ext/standard/tests/array/array_filter_variation10.phpt b/ext/standard/tests/array/array_filter_variation10.phpt index 4749fe8e45..a32fdadc05 100644 --- a/ext/standard/tests/array/array_filter_variation10.phpt +++ b/ext/standard/tests/array/array_filter_variation10.phpt @@ -48,7 +48,11 @@ var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_KEY)); var_dump(array_filter($mixed, 'is_numeric', 0)); -var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_BOTH)); +try { + var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_BOTH)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -88,14 +92,5 @@ array(2) { ["b"]=> int(2) } - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 -array(0) { -} +is_numeric() expects exactly 1 parameter, 2 given Done diff --git a/ext/standard/tests/array/array_filter_variation9.phpt b/ext/standard/tests/array/array_filter_variation9.phpt index ed89d13d35..1755a322b0 100644 --- a/ext/standard/tests/array/array_filter_variation9.phpt +++ b/ext/standard/tests/array/array_filter_variation9.phpt @@ -22,10 +22,18 @@ var_dump( array_filter($input, 'is_int') ); var_dump( array_filter($input, 'chr') ); // using language construct 'echo' as 'callback' -var_dump( array_filter($input, 'echo') ); +try { + var_dump( array_filter($input, 'echo') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // using language construct 'exit' as 'callback' -var_dump( array_filter($input, 'exit') ); +try { + var_dump( array_filter($input, 'exit') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -63,10 +71,6 @@ array(8) { [7]=> NULL } - -Warning: array_filter() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL - -Warning: array_filter() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL +array_filter() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name +array_filter() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt index 65432379d7..f4b91503bc 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt @@ -14,19 +14,23 @@ $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); $array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); //function name within double quotes -var_dump( array_intersect_ukey($array1, $array2, "unknown_function") ); +try { + var_dump( array_intersect_ukey($array1, $array2, "unknown_function") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //function name within single quotes -var_dump( array_intersect_ukey($array1, $array2, 'unknown_function') ); +try { + var_dump( array_intersect_ukey($array1, $array2, 'unknown_function') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== --EXPECTF-- *** Testing array_intersect_ukey() : usage variation *** - -Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL - -Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL +array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name +array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name ===DONE=== diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt index 61faf0158d..e917815337 100644 --- a/ext/standard/tests/array/array_key_exists.phpt +++ b/ext/standard/tests/array/array_key_exists.phpt @@ -69,24 +69,8 @@ foreach ($search_arrays_v as $search_array) { } echo "\n*** Testing error conditions ***\n"; -//Zeor args -var_dump( array_key_exists() ); // first args as array var_dump( array_key_exists(array(), array()) ); -// second args as string -var_dump( array_key_exists("", "") ); -// second args a integer -var_dump( array_key_exists(1, 1) ); -// second args as NULL -var_dump( array_key_exists(1, NULL) ); -// second args as boolean -var_dump( array_key_exists(1, true) ); -// first args as boolean -var_dump( array_key_exists(false, true) ); -// second args as float -var_dump( array_key_exists(false, 17.5) ); -// args more than expected -var_dump( array_key_exists(1, array(), array()) ); // first argument as floating point value var_dump( array_key_exists(17.5, array(1,23) ) ) ; @@ -249,33 +233,9 @@ bool(true) *** Testing error conditions *** -Warning: array_key_exists() expects exactly 2 parameters, 0 given in %s on line %d -NULL - Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d bool(false) -Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, int given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, float given in %s on line %d -NULL - -Warning: array_key_exists() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d bool(false) diff --git a/ext/standard/tests/array/array_keys_error.phpt b/ext/standard/tests/array/array_keys_error.phpt index 46a989b839..0febae29c7 100644 --- a/ext/standard/tests/array/array_keys_error.phpt +++ b/ext/standard/tests/array/array_keys_error.phpt @@ -3,32 +3,19 @@ Test array_keys() function (error conditions) --FILE-- <?php -echo "\n*** Testing error conditions ***"; -var_dump(array_keys(100)); -var_dump(array_keys("string")); -var_dump(array_keys(new stdclass)); // object -var_dump(array_keys()); // Zero arguments -var_dump(array_keys(array(), "", TRUE, 100)); // args > expected +echo "\n*** Testing error conditions ***\n"; +try { + var_dump(array_keys(new stdclass)); // object +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(array_keys(array(1,2,3, new stdClass => array()))); // (W)illegal offset echo "Done\n"; ?> --EXPECTF-- *** Testing error conditions *** -Warning: array_keys() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_keys() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_keys() expects parameter 1 to be array, object given in %s on line %d -NULL - -Warning: array_keys() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_keys() expects at most 3 parameters, 4 given in %s on line %d -NULL +array_keys() expects parameter 1 to be array, object given Warning: Illegal offset type in %s on line %d array(3) { diff --git a/ext/standard/tests/array/array_map_error.phpt b/ext/standard/tests/array/array_map_error.phpt index 56dd033521..d15f28425e 100644 --- a/ext/standard/tests/array/array_map_error.phpt +++ b/ext/standard/tests/array/array_map_error.phpt @@ -9,10 +9,6 @@ Test array_map() function : error conditions echo "*** Testing array_map() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing array_map() function with Zero arguments --\n"; -var_dump( array_map() ); - // Testing array_map with one less than the expected number of arguments echo "\n-- Testing array_map() function with one less than expected no. of arguments --\n"; function callback1() { @@ -45,15 +41,8 @@ echo "Done"; --EXPECTF-- *** Testing array_map() : error conditions *** --- Testing array_map() function with Zero arguments -- - -Warning: array_map() expects at least 2 parameters, 0 given in %s on line %d%d -NULL - -- Testing array_map() function with one less than expected no. of arguments -- - -Warning: array_map() expects at least 2 parameters, 1 given in %s on line %d%d -NULL +Exception: array_map() expects at least 2 parameters, 1 given -- Testing array_map() function with less no. of arrays than callback function arguments -- Exception: Too few arguments to function callback2(), 1 passed and exactly 2 expected diff --git a/ext/standard/tests/array/array_map_object1.phpt b/ext/standard/tests/array/array_map_object1.phpt index 944fc8c2c8..43cc4484e6 100644 --- a/ext/standard/tests/array/array_map_object1.phpt +++ b/ext/standard/tests/array/array_map_object1.phpt @@ -28,7 +28,11 @@ class SimpleClass } function test($cb, $args) { echo join('::', $cb) . "\n"; - var_dump(array_map($cb, $args)); + try { + var_dump(array_map($cb, $args)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } test(array('SimpleClass', 'square'), array(1, 2)); @@ -135,21 +139,15 @@ array(2) { -- simple class with private variable and method -- SimpleClassPri::add - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add() -- simple class with protected variable and method -- SimpleClassPro::mul - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul() -- class without members -- EmptyClass - -Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, array must have exactly two members -- abstract class -- ChildClass::emptyFunction @@ -182,13 +180,9 @@ array(2) { int(4) } StaticClass::cube - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube() StaticClass::retVal - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal() -- class implementing an interface -- InterClass::square array(2) { diff --git a/ext/standard/tests/array/array_map_object2.phpt b/ext/standard/tests/array/array_map_object2.phpt index 7cfb528bf2..e5218ccbe4 100644 --- a/ext/standard/tests/array/array_map_object2.phpt +++ b/ext/standard/tests/array/array_map_object2.phpt @@ -26,21 +26,25 @@ class SimpleClass } echo "-- with non-existent class --\n"; -var_dump( array_map(array('non-existent', 'square'), array(1, 2)) ); +try { + var_dump( array_map(array('non-existent', 'square'), array(1, 2)) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- with existent class and non-existent method --\n"; -var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) ); +try { + var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> --EXPECTF-- *** Testing array_map() : with non-existent class and method *** -- with non-existent class -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'non-existent' not found in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'non-existent' not found -- with existent class and non-existent method -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'SimpleClass' does not have a method 'non-existent' in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'SimpleClass' does not have a method 'non-existent' Done diff --git a/ext/standard/tests/array/array_map_object3.phpt b/ext/standard/tests/array/array_map_object3.phpt index 114d1d3134..2f1536df5c 100644 --- a/ext/standard/tests/array/array_map_object3.phpt +++ b/ext/standard/tests/array/array_map_object3.phpt @@ -51,13 +51,21 @@ echo "-- accessing parent method from child class --\n"; var_dump( array_map(array('ChildClass', 'staticParent1'), $arr1) ); echo "-- accessing child method from parent class --\n"; -var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) ); +try { + var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- accessing parent method using child class object --\n"; var_dump( array_map(array($childobj, 'staticParent1'), $arr1) ); echo "-- accessing child method using parent class object --\n"; -var_dump( array_map(array($parentobj, 'staticChild'), $arr1) ); +try { + var_dump( array_map(array($parentobj, 'staticChild'), $arr1) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -73,9 +81,7 @@ array(3) { int(7) } -- accessing child method from parent class -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' -- accessing parent method using child class object -- array(3) { [0]=> @@ -86,7 +92,5 @@ array(3) { int(7) } -- accessing child method using parent class object -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' Done diff --git a/ext/standard/tests/array/array_map_variation12.phpt b/ext/standard/tests/array/array_map_variation12.phpt index b258c2d31b..67abde0108 100644 --- a/ext/standard/tests/array/array_map_variation12.phpt +++ b/ext/standard/tests/array/array_map_variation12.phpt @@ -20,10 +20,18 @@ echo "-- with built-in function 'pow' and two parameters --\n"; var_dump( array_map('pow', $array1, $array2)); echo "-- with built-in function 'pow' and one parameter --\n"; -var_dump( array_map('pow', $array1)); +try { + var_dump( array_map('pow', $array1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- with language construct --\n"; -var_dump( array_map('echo', $array1)); +try { + var_dump( array_map('echo', $array1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -39,22 +47,7 @@ array(3) { int(243) } -- with built-in function 'pow' and one parameter -- - -Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d -array(3) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL -} +pow() expects exactly 2 parameters, 1 given -- with language construct -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_map_variation14.phpt b/ext/standard/tests/array/array_map_variation14.phpt index 771d3f949e..2764cb7374 100644 --- a/ext/standard/tests/array/array_map_variation14.phpt +++ b/ext/standard/tests/array/array_map_variation14.phpt @@ -36,10 +36,18 @@ echo "-- with undefined variable --\n"; var_dump( array_map(@$undefined_var, $arr1) ); echo "-- with empty string --\n"; -var_dump( array_map("", $arr1, $arr2) ); +try { + var_dump( array_map("", $arr1, $arr2) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- with empty array --\n"; -var_dump( array_map(array(), $arr1, $arr2) ); +try { + var_dump( array_map(array(), $arr1, $arr2) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -115,11 +123,7 @@ array(2) { int(2) } -- with empty string -- - -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name -- with empty array -- - -Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, array must have exactly two members Done diff --git a/ext/standard/tests/array/array_map_variation15.phpt b/ext/standard/tests/array/array_map_variation15.phpt index b29af47713..f36d55bd5f 100644 --- a/ext/standard/tests/array/array_map_variation15.phpt +++ b/ext/standard/tests/array/array_map_variation15.phpt @@ -18,13 +18,15 @@ $arr1 = array(1, 2); $arr2 = array("one", "two"); $arr3 = array(1.1, 2.2); -var_dump( array_map('non_existent', $arr1, $arr2, $arr3) ); +try { + var_dump( array_map('non_existent', $arr1, $arr2, $arr3) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_map() : non existent 'callback' function *** - -Warning: array_map() expects parameter 1 to be a valid callback, function 'non_existent' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'non_existent' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_map_variation16.phpt b/ext/standard/tests/array/array_map_variation16.phpt index c4987cb385..0c80337c76 100644 --- a/ext/standard/tests/array/array_map_variation16.phpt +++ b/ext/standard/tests/array/array_map_variation16.phpt @@ -30,8 +30,12 @@ $callback_names = array( ); for($count = 0; $count < count($callback_names); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( array_map($callback_names[$count], $arr1) ); + echo "-- Iteration ".($count + 1)." --\n"; + try { + var_dump( array_map($callback_names[$count], $arr1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } echo "Done"; @@ -39,35 +43,19 @@ echo "Done"; --EXPECTF-- *** Testing array_map() : non-permmited built-in functions *** -- Iteration 1 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name -- Iteration 2 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name -- Iteration 3 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name -- Iteration 4 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name -- Iteration 5 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name -- Iteration 6 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name -- Iteration 7 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name -- Iteration 8 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_map_variation17.phpt b/ext/standard/tests/array/array_map_variation17.phpt index 1cfbdd7beb..4558dc999f 100644 --- a/ext/standard/tests/array/array_map_variation17.phpt +++ b/ext/standard/tests/array/array_map_variation17.phpt @@ -66,93 +66,77 @@ $unexpected_callbacks = array( // loop through each element of $inputs to check the behavior of array_map for($count = 0; $count < count($unexpected_callbacks); $count++) { - echo "\n-- Iteration ".($count + 1)." --"; - var_dump( array_map($unexpected_callbacks[$count], $arr1)); + echo "\n-- Iteration ".($count + 1)." --\n"; + try { + var_dump( array_map($unexpected_callbacks[$count], $arr1)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_map() : unexpected values for 'callback' argument *** -- Iteration 1 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 2 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 3 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 4 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 5 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 6 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 7 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 8 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 9 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 10 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 11 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 12 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 13 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 14 -- -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name -- Iteration 15 -- -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name -- Iteration 16 -- -Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, array must have exactly two members -- Iteration 17 -- -Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object -- Iteration 18 -- -Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object -- Iteration 19 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 20 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given Done diff --git a/ext/standard/tests/array/array_merge.phpt b/ext/standard/tests/array/array_merge.phpt index e6a8096282..98cb3a318f 100644 --- a/ext/standard/tests/array/array_merge.phpt +++ b/ext/standard/tests/array/array_merge.phpt @@ -78,12 +78,13 @@ var_dump(array_merge($begin_array[6])); echo "\n*** Testing array_merge() with typecasting non-array to array ***\n"; var_dump(array_merge($begin_array[4], (array)"type1", (array)10, (array)12.34)); -echo "\n*** Testing error conditions ***"; +echo "\n*** Testing error conditions ***\n"; /* Invalid arguments */ -var_dump(array_merge()); -var_dump(array_merge(100, 200)); -var_dump(array_merge($begin_array[0], $begin_array[1], 100)); -var_dump(array_merge($begin_array[0], $begin_array[1], $arr4)); +try { + var_dump(array_merge()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -746,17 +747,5 @@ array(7) { } *** Testing error conditions *** -Warning: array_merge() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_merge(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - -Notice: Undefined variable: arr4 in %s on line %d - -Warning: array_merge(): Expected parameter 3 to be an array, null given in %s on line %d -NULL +array_merge() expects at least 1 parameter, 0 given Done diff --git a/ext/standard/tests/array/array_merge_recursive_error.phpt b/ext/standard/tests/array/array_merge_recursive_error.phpt index ffa9cc998e..f741220837 100644 --- a/ext/standard/tests/array/array_merge_recursive_error.phpt +++ b/ext/standard/tests/array/array_merge_recursive_error.phpt @@ -11,7 +11,11 @@ echo "*** Testing array_merge_recursive() : error conditions ***\n"; // Zero arguments echo "\n-- Testing array_merge_recursive() function with Zero arguments --\n"; -var_dump( array_merge_recursive() ); +try { + var_dump( array_merge_recursive() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -19,7 +23,5 @@ echo "Done"; *** Testing array_merge_recursive() : error conditions *** -- Testing array_merge_recursive() function with Zero arguments -- - -Warning: array_merge_recursive() expects at least 1 parameter, 0 given in %s on line %d -NULL +array_merge_recursive() expects at least 1 parameter, 0 given Done diff --git a/ext/standard/tests/array/array_multisort_error.phpt b/ext/standard/tests/array/array_multisort_error.phpt index 3e78b78ac0..105662be07 100644 --- a/ext/standard/tests/array/array_multisort_error.phpt +++ b/ext/standard/tests/array/array_multisort_error.phpt @@ -10,10 +10,6 @@ Test array_multisort() function : error conditions echo "*** Testing array_multisort() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing array_multisort() function with Zero arguments --\n"; -var_dump( array_multisort() ); - echo "\n-- Testing array_multisort() function with repeated flags --\n"; $ar1 = array(1); var_dump( array_multisort($ar1, SORT_ASC, SORT_ASC) ); @@ -27,11 +23,6 @@ var_dump( array_multisort($ar1, SORT_STRING, SORT_NUMERIC) ); --EXPECTF-- *** Testing array_multisort() : error conditions *** --- Testing array_multisort() function with Zero arguments -- - -Warning: array_multisort() expects at least 1 parameter, 0 given in %sarray_multisort_error.php on line %d -NULL - -- Testing array_multisort() function with repeated flags -- Warning: array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified in %sarray_multisort_error.php on line %d diff --git a/ext/standard/tests/array/array_pad.phpt b/ext/standard/tests/array/array_pad.phpt index c267516730..fd5fa520b6 100644 --- a/ext/standard/tests/array/array_pad.phpt +++ b/ext/standard/tests/array/array_pad.phpt @@ -3,9 +3,6 @@ array_pad() tests --FILE-- <?php -var_dump(array_pad()); -var_dump(array_pad(array())); -var_dump(array_pad(array(), 1)); var_dump(array_pad(array(), 1, 0)); var_dump(array_pad(array(), 0, 0)); @@ -16,19 +13,10 @@ var_dump(array_pad(array("", -1, 2.0), 2, array())); var_dump(array_pad(array("", -1, 2.0), -3, array())); var_dump(array_pad(array("", -1, 2.0), -4, array())); var_dump(array_pad(array("", -1, 2.0), 2000000, 0)); -var_dump(array_pad("", 2000000, 0)); echo "Done\n"; ?> --EXPECTF-- -Warning: array_pad() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: array_pad() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: array_pad() expects exactly 3 parameters, 2 given in %s on line %d -NULL array(1) { [0]=> int(0) @@ -95,7 +83,4 @@ array(4) { Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d bool(false) - -Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d -NULL Done diff --git a/ext/standard/tests/array/array_push.phpt b/ext/standard/tests/array/array_push.phpt index 52e754f94d..227a520ac1 100644 --- a/ext/standard/tests/array/array_push.phpt +++ b/ext/standard/tests/array/array_push.phpt @@ -31,16 +31,7 @@ $mixed_array = array( ); /* Error Conditions */ -echo "\n*** Testing Error Conditions ***\n"; - -/* Zero argument */ -var_dump( array_push() ); - -/* Scalar argument */ -var_dump( array_push($number, 22) ); - -/* String argument */ -var_dump( array_push($str, 22) ); +echo "\n*** Testing Edge Conditions ***\n"; /* Invalid Number of arguments */ var_dump( array_push($mixed_array[1],1,2) ); @@ -70,16 +61,7 @@ var_dump( $mixed_array[2] ); echo"\nDone"; ?> --EXPECTF-- -*** Testing Error Conditions *** - -Warning: array_push() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_push() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_push() expects parameter 1 to be array, string given in %s on line %d -NULL +*** Testing Edge Conditions *** int(11) int(1) diff --git a/ext/standard/tests/array/array_rand.phpt b/ext/standard/tests/array/array_rand.phpt index db432dc9b4..72999eda5f 100644 --- a/ext/standard/tests/array/array_rand.phpt +++ b/ext/standard/tests/array/array_rand.phpt @@ -3,10 +3,8 @@ array_rand() tests --FILE-- <?php -var_dump(array_rand()); var_dump(array_rand(array())); var_dump(array_rand(array(), 0)); -var_dump(array_rand(0, 0)); var_dump(array_rand(array(1,2,3), 0)); var_dump(array_rand(array(1,2,3), -1)); var_dump(array_rand(array(1,2,3), 10)); @@ -16,18 +14,12 @@ var_dump(array_rand(array(1,2,3), 2)); echo "Done\n"; ?> --EXPECTF-- -Warning: array_rand() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: array_rand(): Array is empty in %s on line %d NULL Warning: array_rand(): Array is empty in %s on line %d NULL -Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d -NULL - Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d NULL diff --git a/ext/standard/tests/array/array_search1.phpt b/ext/standard/tests/array/array_search1.phpt index 49563f9712..10c1672e54 100644 --- a/ext/standard/tests/array/array_search1.phpt +++ b/ext/standard/tests/array/array_search1.phpt @@ -5,8 +5,6 @@ array_search() tests $a = array(1=>0, 2=>1, 4=>3, "a"=>"b", "c"=>"d"); -var_dump(array_search(1)); -var_dump(array_search(1,1)); var_dump(array_search("a",$a)); var_dump(array_search("0",$a, true)); var_dump(array_search("0",$a)); @@ -18,12 +16,7 @@ var_dump(array_search(-1,$a, true)); echo "Done\n"; ?> ---EXPECTF-- -Warning: array_search() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: array_search() expects parameter 2 to be array, int given in %s on line %d -NULL +--EXPECT-- int(1) bool(false) int(1) diff --git a/ext/standard/tests/array/array_search_variation3.phpt b/ext/standard/tests/array/array_search_variation3.phpt index 41b0b5bb20..596c36f805 100644 --- a/ext/standard/tests/array/array_search_variation3.phpt +++ b/ext/standard/tests/array/array_search_variation3.phpt @@ -33,9 +33,17 @@ class array_search_check { $array_search_obj = new array_search_check(); //creating new object //error: as wrong datatype for second argument -var_dump( array_search("array_var", $array_search_obj) ); +try { + var_dump( array_search("array_var", $array_search_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //error: as wrong datatype for second argument -var_dump( array_search("foo", $array_search_obj) ); +try { + var_dump( array_search("foo", $array_search_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //element found as "one" exists in array $array_var var_dump( array_search("one", $array_search_obj->array_var) ); @@ -48,11 +56,7 @@ string(5) "three" int(5) *** Testing objects with array_search() *** - -Warning: array_search() expects parameter 2 to be array, object given in %s on line %d -NULL - -Warning: array_search() expects parameter 2 to be array, object given in %s on line %d -NULL +array_search() expects parameter 2 to be array, object given +array_search() expects parameter 2 to be array, object given int(1) Done diff --git a/ext/standard/tests/array/array_slice.phpt b/ext/standard/tests/array/array_slice.phpt index 59d804350b..d19f5195d6 100644 --- a/ext/standard/tests/array/array_slice.phpt +++ b/ext/standard/tests/array/array_slice.phpt @@ -20,26 +20,6 @@ $var_array = array( $num = 4; $str = "john"; -/* Zero args */ -echo"\n*** Output for Zero Argument ***\n"; -array_slice(); - -/* Single args */ -echo"\n*** Output for Single array Argument ***\n"; -array_slice($var_array); - -/* More than valid no. of args (ie. >4 ) */ -echo"\n*** Output for invalid number of Arguments ***\n"; -array_slice($var_array, 2, 4, true, 3); - -/* Scalar arg */ -echo"\n*** Output for scalar Argument ***\n"; -array_slice($num, 2); - -/* String arg */ -echo"\n*** Output for string Argument ***\n"; -array_slice($str, 2); - $counter = 1; foreach ($var_array as $sub_array) { @@ -89,26 +69,6 @@ foreach ($var_array as $sub_array) ?> --EXPECTF-- -*** Output for Zero Argument *** - -Warning: array_slice() expects at least 2 parameters, 0 given in %s on line %d - -*** Output for Single array Argument *** - -Warning: array_slice() expects at least 2 parameters, 1 given in %s on line %d - -*** Output for invalid number of Arguments *** - -Warning: array_slice() expects at most 4 parameters, 5 given in %s on line %d - -*** Output for scalar Argument *** - -Warning: array_slice() expects parameter 1 to be array, int given in %s on line %d - -*** Output for string Argument *** - -Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d - *** Iteration 1 *** *** Variation with first two Arguments *** diff --git a/ext/standard/tests/array/array_slice_variation1.phpt b/ext/standard/tests/array/array_slice_variation1.phpt index f0c30ba53d..46f33b9503 100644 --- a/ext/standard/tests/array/array_slice_variation1.phpt +++ b/ext/standard/tests/array/array_slice_variation1.phpt @@ -15,8 +15,16 @@ var_dump(array_slice(range(1, 3), -1, NULL, 1)); $a = 'foo'; -var_dump(array_slice(range(1, 3), 0, $a)); -var_dump(array_slice(range(1, 3), 0, $a)); +try { + var_dump(array_slice(range(1, 3), 0, $a)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(array_slice(range(1, 3), 0, $a)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($a); ?> @@ -53,10 +61,6 @@ array(1) { [2]=> int(3) } - -Warning: array_slice() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: array_slice() expects parameter 3 to be int, string given in %s on line %d -NULL +array_slice() expects parameter 3 to be int, string given +array_slice() expects parameter 3 to be int, string given string(3) "foo" diff --git a/ext/standard/tests/array/array_unshift.phpt b/ext/standard/tests/array/array_unshift.phpt index 9b474277a9..9ebe83391e 100644 --- a/ext/standard/tests/array/array_unshift.phpt +++ b/ext/standard/tests/array/array_unshift.phpt @@ -7,8 +7,6 @@ $a = array(); $s = ""; var_dump(array_unshift($a, $s)); var_dump($a); -var_dump(array_unshift($s, $a)); -var_dump($a); var_dump(array_unshift($a, $a)); var_dump($a); @@ -20,13 +18,6 @@ array(1) { [0]=> string(0) "" } - -Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d -NULL -array(1) { - [0]=> - string(0) "" -} int(2) array(2) { [0]=> diff --git a/ext/standard/tests/array/array_walk.phpt b/ext/standard/tests/array/array_walk.phpt index 7cd8a8cf7a..cf792bfa19 100644 --- a/ext/standard/tests/array/array_walk.phpt +++ b/ext/standard/tests/array/array_walk.phpt @@ -3,12 +3,6 @@ array_walk() tests --FILE-- <?php -var_dump(array_walk()); -$var = 1; -var_dump(array_walk($var,1)); -$var = array(); -var_dump(array_walk($var,"")); - function foo($v1, $v2, $v3) { var_dump($v1); var_dump($v2); @@ -31,14 +25,6 @@ try { echo "Done\n"; ?> --EXPECTF-- -Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL int(1) int(0) string(4) "data" diff --git a/ext/standard/tests/array/array_walk_closure.phpt b/ext/standard/tests/array/array_walk_closure.phpt index 0a5d854582..7ac62d7484 100644 --- a/ext/standard/tests/array/array_walk_closure.phpt +++ b/ext/standard/tests/array/array_walk_closure.phpt @@ -3,14 +3,6 @@ array_walk() closure tests --FILE-- <?php -var_dump(array_walk()); - -$ar = false; -var_dump(array_walk($ar, $ar)); - -$ar = NULL; -var_dump(array_walk($ar, $ar)); - $ar = ["one" => 1, "two"=>2, "three" => 3]; var_dump(array_walk($ar, function(){ var_dump(func_get_args());})); @@ -94,14 +86,6 @@ try { echo "Done\n"; ?> --EXPECTF-- -Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d -NULL array(2) { [0]=> int(1) diff --git a/ext/standard/tests/array/array_walk_error2.phpt b/ext/standard/tests/array/array_walk_error2.phpt index a4026180fb..73445892a6 100644 --- a/ext/standard/tests/array/array_walk_error2.phpt +++ b/ext/standard/tests/array/array_walk_error2.phpt @@ -61,7 +61,5 @@ Exception: Too few arguments to function callback2(), 3 passed and exactly 4 exp Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected -- Testing array_walk() function with too many callback parameters -- - -Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d -NULL +Exception: array_walk() expects at most 3 parameters, 4 given Done diff --git a/ext/standard/tests/array/array_walk_objects.phpt b/ext/standard/tests/array/array_walk_objects.phpt index fc04304fc5..9f3ac8c1cd 100644 --- a/ext/standard/tests/array/array_walk_objects.phpt +++ b/ext/standard/tests/array/array_walk_objects.phpt @@ -24,7 +24,11 @@ array_walk($t, "walk"); $var = array(); array_walk($var, "walk"); $var = ""; -array_walk($var, "walk"); +try { + array_walk($var, "walk"); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -39,6 +43,5 @@ string(10) "%r\0%r*%r\0%rvar_pro" string(14) "test_protected" string(7) "var_pub" string(11) "test_public" - -Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d +array_walk() expects parameter 1 to be array, string given Done diff --git a/ext/standard/tests/array/array_walk_rec_objects.phpt b/ext/standard/tests/array/array_walk_rec_objects.phpt index a83c227a3b..097143e8ec 100644 --- a/ext/standard/tests/array/array_walk_rec_objects.phpt +++ b/ext/standard/tests/array/array_walk_rec_objects.phpt @@ -24,7 +24,11 @@ array_walk_recursive($t, "walk"); $var = array(); array_walk_recursive($var, "walk"); $var = ""; -array_walk_recursive($var, "walk"); +try { + array_walk_recursive($var, "walk"); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -39,6 +43,5 @@ string(10) "%r\0%r*%r\0%rvar_pro" string(14) "test_protected" string(7) "var_pub" string(11) "test_public" - -Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d +array_walk_recursive() expects parameter 1 to be array, string given Done diff --git a/ext/standard/tests/array/array_walk_recursive1.phpt b/ext/standard/tests/array/array_walk_recursive1.phpt index 962f133e4c..f952b4410b 100644 --- a/ext/standard/tests/array/array_walk_recursive1.phpt +++ b/ext/standard/tests/array/array_walk_recursive1.phpt @@ -3,12 +3,6 @@ array_walk_recursive() tests --FILE-- <?php -var_dump(array_walk_recursive()); -$var = 1; -var_dump(array_walk_recursive($var,1)); -$var = array(); -var_dump(array_walk_recursive($var,"")); - function foo($v1, $v2, $v3) { var_dump($v1); var_dump($v2); @@ -31,14 +25,6 @@ try { echo "Done\n"; ?> --EXPECTF-- -Warning: array_walk_recursive() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL int(1) int(0) string(4) "data" diff --git a/ext/standard/tests/array/array_walk_recursive_error2.phpt b/ext/standard/tests/array/array_walk_recursive_error2.phpt index b162a1c9dc..e9bd7ea175 100644 --- a/ext/standard/tests/array/array_walk_recursive_error2.phpt +++ b/ext/standard/tests/array/array_walk_recursive_error2.phpt @@ -61,7 +61,5 @@ Exception: Too few arguments to function callback2(), 3 passed and exactly 4 exp Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected -- Testing array_walk_recursive() function with too many callback parameters -- - -Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d -NULL +Exception: array_walk_recursive() expects at most 3 parameters, 4 given Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation7.phpt b/ext/standard/tests/array/array_walk_recursive_variation7.phpt index 06dc1aaa09..a0c159d71d 100644 --- a/ext/standard/tests/array/array_walk_recursive_variation7.phpt +++ b/ext/standard/tests/array/array_walk_recursive_variation7.phpt @@ -29,9 +29,6 @@ var_dump( array_walk_recursive($input, function($value, $key) { var_dump($key); echo "-- Anonymous function with three arguments --\n"; var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10)); -echo "-- Anonymous function with one more argument --\n"; -var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30)); - echo "-- Anonymous function with null argument --\n"; var_dump( array_walk_recursive( $input, function() { echo "1\n"; })); echo "Done" @@ -80,10 +77,6 @@ int(0) int(10) bool(true) --- Anonymous function with one more argument -- - -Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d -NULL -- Anonymous function with null argument -- 1 1 diff --git a/ext/standard/tests/array/array_walk_recursive_variation8.phpt b/ext/standard/tests/array/array_walk_recursive_variation8.phpt index 2db8067fe0..51eba1e0e0 100644 --- a/ext/standard/tests/array/array_walk_recursive_variation8.phpt +++ b/ext/standard/tests/array/array_walk_recursive_variation8.phpt @@ -25,7 +25,11 @@ echo "-- With 'min' built-in function --\n"; var_dump( array_walk_recursive($input, "min")); echo "-- With 'echo' language construct --\n"; -var_dump( array_walk_recursive($input, "echo")); +try { + var_dump( array_walk_recursive($input, "echo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -36,7 +40,5 @@ bool(true) -- With 'min' built-in function -- bool(true) -- With 'echo' language construct -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_walk_recursive() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_walk_variation7.phpt b/ext/standard/tests/array/array_walk_variation7.phpt index 671ad44309..0354782eda 100644 --- a/ext/standard/tests/array/array_walk_variation7.phpt +++ b/ext/standard/tests/array/array_walk_variation7.phpt @@ -29,9 +29,6 @@ var_dump( array_walk($input, function($value, $key) { var_dump($key); var_dump($ echo "-- Anonymous function with three arguments --\n"; var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10)); -echo "-- Anonymous function with one more argument --\n"; -var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30)); - echo "-- Anonymous function with null argument --\n"; var_dump( array_walk( $input, function() { echo "1\n"; })); echo "Done" @@ -80,10 +77,6 @@ int(0) int(10) bool(true) --- Anonymous function with one more argument -- - -Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d -NULL -- Anonymous function with null argument -- 1 1 diff --git a/ext/standard/tests/array/array_walk_variation8.phpt b/ext/standard/tests/array/array_walk_variation8.phpt index 829baf1add..baa5f3914b 100644 --- a/ext/standard/tests/array/array_walk_variation8.phpt +++ b/ext/standard/tests/array/array_walk_variation8.phpt @@ -25,7 +25,11 @@ echo "-- With 'min' built-in function --\n"; var_dump( array_walk($input, "min")); echo "-- With 'echo' language construct --\n"; -var_dump( array_walk($input, "echo")); +try { + var_dump( array_walk($input, "echo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -36,7 +40,5 @@ bool(true) -- With 'min' built-in function -- bool(true) -- With 'echo' language construct -- - -Warning: array_walk() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_walk() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name Done diff --git a/ext/standard/tests/array/bug35014.phpt b/ext/standard/tests/array/bug35014.phpt index f858bf107b..b674590fd6 100644 --- a/ext/standard/tests/array/bug35014.phpt +++ b/ext/standard/tests/array/bug35014.phpt @@ -7,7 +7,6 @@ precision=14 --FILE-- <?php $tests = array( - 'foo', array(), array(0), array(3), @@ -22,9 +21,7 @@ foreach ($tests as $v) { var_dump(array_product($v)); } ?> ---EXPECTF-- -Warning: array_product() expects parameter 1 to be array, string given in %s on line %d -NULL +--EXPECT-- int(1) int(0) int(3) diff --git a/ext/standard/tests/array/bug35014_64bit.phpt b/ext/standard/tests/array/bug35014_64bit.phpt index 5caf48c6ee..3b3d29b5be 100644 --- a/ext/standard/tests/array/bug35014_64bit.phpt +++ b/ext/standard/tests/array/bug35014_64bit.phpt @@ -7,7 +7,6 @@ precision=14 --FILE-- <?php $tests = array( - 'foo', array(), array(0), array(3), @@ -22,9 +21,7 @@ foreach ($tests as $v) { var_dump(array_product($v)); } ?> ---EXPECTF-- -Warning: array_product() expects parameter 1 to be array, string given in %s on line %d -NULL +--EXPECT-- int(1) int(0) int(3) diff --git a/ext/standard/tests/array/bug40191.phpt b/ext/standard/tests/array/bug40191.phpt index f5e439821d..b94e709364 100644 --- a/ext/standard/tests/array/bug40191.phpt +++ b/ext/standard/tests/array/bug40191.phpt @@ -8,12 +8,14 @@ $arrObj->append('foo'); $arrObj->append('bar'); $arrObj->append('foo'); -$arr = array_unique($arrObj); -var_dump($arr); +try { + $arr = array_unique($arrObj); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> ---EXPECTF-- -Warning: array_unique() expects parameter 1 to be array, object given in %s on line %d -NULL +--EXPECT-- +array_unique() expects parameter 1 to be array, object given Done diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt index 6d81c16621..1fd2e8e6ca 100644 --- a/ext/standard/tests/array/count_recursive.phpt +++ b/ext/standard/tests/array/count_recursive.phpt @@ -111,16 +111,6 @@ for( $i =0; $i < count( $mode_arr ); $i++) { var_dump(count($arr, $mode_arr[$i])); } - -echo "\n-- Testing error conditions --"; -var_dump( count() ); // No. of args = 0 -var_dump( count(array(), COUNT_NORMAL, 100) ); // No. of args > expected - -/* Testing Invalid type arguments */ -var_dump( count("string", "ABCD") ); -var_dump( count(100, "string") ); -var_dump( count(array(), "") ); - echo "\nDone"; /* closing the resource handles */ @@ -230,20 +220,4 @@ For mode '1' count is => int(9) For mode '' count is => int(3) For mode '' count is => int(3) --- Testing error conditions -- -Warning: count() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: count() expects at most 2 parameters, 3 given in %s on line %d -NULL - -Warning: count() expects parameter 2 to be int, %s given in %s on line %d -NULL - -Warning: count() expects parameter 2 to be int, %s given in %s on line %d -NULL - -Warning: count() expects parameter 2 to be int, %s given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/array/end.phpt b/ext/standard/tests/array/end.phpt index dc3f2eb75e..496b6c9566 100644 --- a/ext/standard/tests/array/end.phpt +++ b/ext/standard/tests/array/end.phpt @@ -106,21 +106,6 @@ $resources = array($file_handle, $dir_handle); var_dump( end($resources) ); var_dump( current($resources) ); -echo "\n*** Testing error conditions ***\n"; -/* checking for unexpected number of arguments */ -var_dump( end() ); -var_dump( end($array[0], $array[0]) ); - -/* checking for unexpected type of arguments */ -$var=1; -$var1="string"; -var_dump( end($var) ); -var_dump( end($var1) ); - -/* checking null array */ -$null_array = array(); -var_dump( end($null_array) ); - echo "Done\n"; @@ -219,19 +204,4 @@ array(2) { *** Testing end() on resource type *** resource(%d) of type (stream) resource(%d) of type (stream) - -*** Testing error conditions *** - -Warning: end() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: end() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, string given in %s on line %d -NULL -bool(false) Done diff --git a/ext/standard/tests/array/end_64bit.phpt b/ext/standard/tests/array/end_64bit.phpt index 0af5064e82..55f0d2e53b 100644 --- a/ext/standard/tests/array/end_64bit.phpt +++ b/ext/standard/tests/array/end_64bit.phpt @@ -106,21 +106,6 @@ $resources = array($file_handle, $dir_handle); var_dump( end($resources) ); var_dump( current($resources) ); -echo "\n*** Testing error conditions ***\n"; -/* checking for unexpected number of arguments */ -var_dump( end() ); -var_dump( end($array[0], $array[0]) ); - -/* checking for unexpected type of arguments */ -$var=1; -$var1="string"; -var_dump( end($var) ); -var_dump( end($var1) ); - -/* checking null array */ -$null_array = array(); -var_dump( end($null_array) ); - echo "Done\n"; ?> @@ -218,19 +203,4 @@ array(2) { *** Testing end() on resource type *** resource(%d) of type (stream) resource(%d) of type (stream) - -*** Testing error conditions *** - -Warning: end() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: end() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, string given in %s on line %d -NULL -bool(false) Done diff --git a/ext/standard/tests/array/extract_error.phpt b/ext/standard/tests/array/extract_error.phpt index e8bcf8f5d8..08e1824b0f 100644 --- a/ext/standard/tests/array/extract_error.phpt +++ b/ext/standard/tests/array/extract_error.phpt @@ -6,25 +6,11 @@ Test extract() function (error conditions) /* Testing Error Conditions */ echo "*** Testing Error Conditions ***\n"; -/* Zero Arguments */ -var_dump( extract() ); - /* Invalid second argument ( only 0-6 is valid) */ $arr = array(1); var_dump( extract($arr, -1 . "wddr") ); var_dump( extract($arr, 7 , "wddr") ); -/* scalar argument */ -$val = 1; -var_dump( extract($val) ); - -/* string argument */ -$str = "test"; -var_dump( extract($str) ); - -/* More than valid number of arguments i.e. 3 args */ -var_dump( extract($arr, EXTR_SKIP, "aa", "ee") ); - /* Two Arguments, second as prefix but without prefix string as third argument */ var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) ); @@ -33,9 +19,6 @@ echo "Done\n"; --EXPECTF-- *** Testing Error Conditions *** -Warning: extract() expects at least 1 parameter, 0 given in %s on line %d -NULL - Notice: A non well formed numeric value encountered in %s on line %d Warning: extract(): Invalid extract type in %s on line %d @@ -44,15 +27,6 @@ NULL Warning: extract(): Invalid extract type in %s on line %d NULL -Warning: extract() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: extract() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: extract() expects at most 3 parameters, 4 given in %s on line %d -NULL - Warning: extract(): specified extract type requires the prefix parameter in %s on line %d NULL Done diff --git a/ext/standard/tests/array/in_array_variation3.phpt b/ext/standard/tests/array/in_array_variation3.phpt index f07d1dea89..0b58990041 100644 --- a/ext/standard/tests/array/in_array_variation3.phpt +++ b/ext/standard/tests/array/in_array_variation3.phpt @@ -36,9 +36,17 @@ class in_array_check { $in_array_obj = new in_array_check(); //creating new object //error: as wrong datatype for second argument -var_dump( in_array("array_var", $in_array_obj) ); +try { + var_dump( in_array("array_var", $in_array_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //error: as wrong datatype for second argument -var_dump( in_array("foo", $in_array_obj) ); +try { + var_dump( in_array("foo", $in_array_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //element found as "one" exists in array $array_var var_dump( in_array("one", $in_array_obj->array_var) ); @@ -51,11 +59,7 @@ bool(true) bool(true) *** Testing objects with in_array() *** - -Warning: in_array() expects parameter 2 to be array, object given in %s on line %d -NULL - -Warning: in_array() expects parameter 2 to be array, object given in %s on line %d -NULL +in_array() expects parameter 2 to be array, object given +in_array() expects parameter 2 to be array, object given bool(true) Done diff --git a/ext/standard/tests/array/max.phpt b/ext/standard/tests/array/max.phpt index ae4f304eae..df471ef255 100644 --- a/ext/standard/tests/array/max.phpt +++ b/ext/standard/tests/array/max.phpt @@ -5,7 +5,6 @@ precision=14 --FILE-- <?php -var_dump(max()); var_dump(max(1)); var_dump(max(array())); var_dump(max(new stdclass)); @@ -20,16 +19,13 @@ var_dump(max(0, true, false, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: max() expects at least 1 parameter, 0 given in %s on line 3 +Warning: max(): When only one parameter is given, it must be an array in %s on line %d NULL -Warning: max(): When only one parameter is given, it must be an array in %s on line 4 -NULL - -Warning: max(): Array must contain at least one element in %s on line 5 +Warning: max(): Array must contain at least one element in %s on line %d bool(false) -Warning: max(): When only one parameter is given, it must be an array in %s on line 6 +Warning: max(): When only one parameter is given, it must be an array in %s on line %d NULL int(2) float(2.11) diff --git a/ext/standard/tests/array/min.phpt b/ext/standard/tests/array/min.phpt index cb8c7cfdca..031e9b2c96 100644 --- a/ext/standard/tests/array/min.phpt +++ b/ext/standard/tests/array/min.phpt @@ -5,7 +5,6 @@ precision=14 --FILE-- <?php -var_dump(min()); var_dump(min(1)); var_dump(min(array())); var_dump(min(new stdclass)); @@ -20,16 +19,13 @@ var_dump(min(0, true, false, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: min() expects at least 1 parameter, 0 given in %s on line 3 +Warning: min(): When only one parameter is given, it must be an array in %s on line %d NULL -Warning: min(): When only one parameter is given, it must be an array in %s on line 4 -NULL - -Warning: min(): Array must contain at least one element in %s on line 5 +Warning: min(): Array must contain at least one element in %s on line %d bool(false) -Warning: min(): When only one parameter is given, it must be an array in %s on line 6 +Warning: min(): When only one parameter is given, it must be an array in %s on line %d NULL int(1) float(2.09) diff --git a/ext/standard/tests/array/range_errors.phpt b/ext/standard/tests/array/range_errors.phpt index b63e9874bf..3a3b2bdf60 100644 --- a/ext/standard/tests/array/range_errors.phpt +++ b/ext/standard/tests/array/range_errors.phpt @@ -21,10 +21,7 @@ var_dump( range(1.0, 7.0, 6.5) ); echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --"; var_dump( range(7.0, 1.0, 6.5) ); -echo "\n-- Testing Invalid number of arguments --"; -var_dump( range() ); // No.of args = 0 -var_dump( range(1) ); // No.of args < expected -var_dump( range(1,2,3,4) ); // No.of args > expected +echo "\n-- Testing other conditions --"; var_dump( range(-1, -2, 2) ); var_dump( range("a", "j", "z") ); var_dump( range(0, 1, "140962482048819216326.24") ); @@ -67,16 +64,7 @@ bool(false) Warning: range(): step exceeds the specified range in %s on line %d bool(false) --- Testing Invalid number of arguments -- -Warning: range() expects at least 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: range() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: range() expects at most 3 parameters, 4 given in %s on line %d -bool(false) - +-- Testing other conditions -- Warning: range(): step exceeds the specified range in %s on line %d bool(false) diff --git a/ext/standard/tests/array/uasort_variation8.phpt b/ext/standard/tests/array/uasort_variation8.phpt index 2bb2b46512..d27cd569c0 100644 --- a/ext/standard/tests/array/uasort_variation8.phpt +++ b/ext/standard/tests/array/uasort_variation8.phpt @@ -10,7 +10,6 @@ Test uasort() function : usage variations - built-in function as 'cmp_function' /* * Passing different built-in library functions in place of 'cmp_function' * valid comparison functions: strcmp() & strcasecmp() -* language constructs: echo & exit */ echo "*** Testing uasort() : built in function as 'cmp_function' ***\n"; @@ -28,13 +27,6 @@ echo "-- Testing uasort() with built-in 'cmp_function': strcmp() --\n"; var_dump( uasort($array_arg, 'strcmp') ); // expecting: bool(true) var_dump($array_arg); -// Testing with language construct as comparison function -echo "-- Testing uasort() with language construct as 'cmp_function' --\n"; -var_dump( uasort($languageConstruct_fun_arg, 'echo') ); // expecting: bool(false) - -echo "-- Testing uasort() with language construct as 'cmp_function' --\n"; -var_dump( uasort($languageConstruct_fun_arg, 'exit') ); // expecting: bool(false) - echo "Done" ?> --EXPECTF-- @@ -67,12 +59,4 @@ array(5) { ["o"]=> string(6) "orange" } --- Testing uasort() with language construct as 'cmp_function' -- - -Warning: uasort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL --- Testing uasort() with language construct as 'cmp_function' -- - -Warning: uasort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL Done diff --git a/ext/standard/tests/array/usort_variation8.phpt b/ext/standard/tests/array/usort_variation8.phpt index 3296c4a36a..98c303e083 100644 --- a/ext/standard/tests/array/usort_variation8.phpt +++ b/ext/standard/tests/array/usort_variation8.phpt @@ -30,14 +30,6 @@ $temp_array2 = $array_arg; var_dump( usort($temp_array2, 'strcmp') ); var_dump($temp_array2); -// Testing with language construct as comparison function -echo "\n-- Testing usort() with language construct as 'cmp_function' --\n"; -$temp_array3 = $array_arg; -var_dump( usort($temp_array3, 'echo') ); - -echo "\n-- Testing usort() with language construct as 'cmp_function' --\n"; -$temp_array4 = $array_arg; -var_dump( usort($temp_array4, 'exit') ); ?> ===DONE=== --EXPECTF-- @@ -72,14 +64,4 @@ array(5) { [4]=> string(6) "orange" } - --- Testing usort() with language construct as 'cmp_function' -- - -Warning: usort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL - --- Testing usort() with language construct as 'cmp_function' -- - -Warning: usort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/assert/assert04.phpt b/ext/standard/tests/assert/assert04.phpt index f20aaf8e2b..35f7668ce1 100644 --- a/ext/standard/tests/assert/assert04.phpt +++ b/ext/standard/tests/assert/assert04.phpt @@ -11,17 +11,8 @@ assert.bail = 0 assert_options(ASSERT_ACTIVE, 0); assert(1); - /* Wrong parameter count in assert */ assert_options(ASSERT_ACTIVE, 1); -assert(2, "failure", 3); - -/* Wrong parameter count in assert_options */ -assert_options(ASSERT_ACTIVE, 0, 2); - -/* Wrong parameter name in assert_options */ -$test="ASSERT_FRED"; -assert_options($test, 1); /* Assert false */ assert(0); @@ -35,12 +26,6 @@ echo "not reached\n"; ?> --EXPECTF-- -Warning: assert() expects at most 2 parameters, 3 given in %s on line %d - -Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d - -Warning: assert_options() expects parameter 1 to be int, string given in %s on line %d - Warning: assert(): assert(0) failed in %s on line %d Warning: assert(): assert(0) failed in %s on line %d diff --git a/ext/standard/tests/class_object/property_exists_error.phpt b/ext/standard/tests/class_object/property_exists_error.phpt index 217a5c61f9..7a2f4712da 100644 --- a/ext/standard/tests/class_object/property_exists_error.phpt +++ b/ext/standard/tests/class_object/property_exists_error.phpt @@ -10,19 +10,8 @@ Test property_exists() function : error conditions echo "*** Testing property_exists() : error conditions ***\n"; -$object_or_class = "obj"; -$property_name = 'string_val'; -$extra_arg = 10; - - -echo "\n-- Testing property_exists() function with more than expected no. of arguments --\n"; -var_dump( property_exists($object_or_class, $property_name, $extra_arg) ); - - -echo "\n-- Testing property_exists() function with less than expected no. of arguments --\n"; -var_dump( property_exists($object_or_class) ); - echo "\n-- Testing property_exists() function with incorrect arguments --\n"; +$property_name = 'string_val'; var_dump( property_exists(10, $property_name) ); ?> @@ -30,16 +19,6 @@ var_dump( property_exists(10, $property_name) ); --EXPECTF-- *** Testing property_exists() : error conditions *** --- Testing property_exists() function with more than expected no. of arguments -- - -Warning: property_exists() expects exactly 2 parameters, 3 given in %sproperty_exists_error.php on line %d -NULL - --- Testing property_exists() function with less than expected no. of arguments -- - -Warning: property_exists() expects exactly 2 parameters, 1 given in %sproperty_exists_error.php on line %d -NULL - -- Testing property_exists() function with incorrect arguments -- Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists_error.php on line %d diff --git a/ext/standard/tests/dir/closedir_error-win32-mb.phpt b/ext/standard/tests/dir/closedir_error-win32-mb.phpt deleted file mode 100644 index e5ca80b7d2..0000000000 --- a/ext/standard/tests/dir/closedir_error-win32-mb.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -Test closedir() function : error conditions - Pass incorrect number of arguments ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die("skip Valid only on Windows"); -} -?> ---FILE-- -<?php -/* Prototype : void closedir([resource $dir_handle]) - * Description: Close directory connection identified by the dir_handle - * Source code: ext/standard/dir.c - * Alias to functions: close - */ - -/* - * Pass incorrect number of arguments to closedir() to test behaviour - */ - -echo "*** Testing closedir() : error conditions ***\n"; - - -//Test closedir with one more than the expected number of arguments -echo "\n-- Testing closedir() function with more than expected no. of arguments --\n"; - -$dir_path = dirname(__FILE__) . '\私はガラスを食べられますclosedir_error'; -mkdir($dir_path); -$dir_handle = opendir($dir_path); - -$extra_arg = 10; -var_dump( closedir($dir_handle, $extra_arg) ); - -//successfully close the directory handle so can delete in CLEAN section -closedir($dir_handle); -?> -===DONE=== ---CLEAN-- -<?php -$base_dir = dirname(__FILE__); -$dir_path = $base_dir . '\私はガラスを食べられますclosedir_error'; -rmdir($dir_path); -?> ---EXPECTF-- -*** Testing closedir() : error conditions *** - --- Testing closedir() function with more than expected no. of arguments -- - -Warning: closedir() expects at most 1 parameter, 2 given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt deleted file mode 100644 index ffb0284d95..0000000000 --- a/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt +++ /dev/null @@ -1,244 +0,0 @@ ---TEST-- -Test scandir() function : usage variations - diff data types as $context arg ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die("skip Valid only on Windows"); -} -?> ---FILE-- -<?php -/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) - * Description: List files & directories inside the specified path - * Source code: ext/standard/dir.c - */ - -/* - * Pass different data types as $context argument to test how scandir() behaves - */ - -echo "*** Testing scandir() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation3'; -mkdir($dir); -$sorting_order = SCANDIR_SORT_ASCENDING; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $context argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of scandir() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( scandir($dir, $sorting_order, $input) ); - $iterator++; -}; - -fclose($fp); -?> -===DONE=== ---CLEAN-- -<?php -$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation3'; -rmdir($dir); -?> ---EXPECTF-- -*** Testing scandir() : usage variations *** - --- Iteration 1 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: scandir() expects parameter 3 to be resource, array given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: scandir() expects parameter 3 to be resource, object given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: scandir(): supplied resource is not a valid Stream-Context resource in %s on line %d -array(2) { - [0]=> - string(1) "." - [1]=> - string(2) ".." -} -===DONE=== diff --git a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt index cba61d3fbf..ed68c2a7d7 100644 --- a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt +++ b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt @@ -21,12 +21,6 @@ var_dump($d->read()); var_dump($d->rewind()); var_dump($d->close()); -echo "\n--> Try all methods with wrong number of args:\n"; -$d = new Directory($d); -var_dump($d->read(1,2)); -var_dump($d->rewind(1,2)); -var_dump($d->close(1,2)); - ?> --CLEAN-- <?php @@ -56,14 +50,3 @@ bool(false) Warning: Directory::close(): Unable to find my handle property in %s on line %d bool(false) - ---> Try all methods with wrong number of args: - -Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d -NULL diff --git a/ext/standard/tests/directory/DirectoryClass_error_001.phpt b/ext/standard/tests/directory/DirectoryClass_error_001.phpt index 5b2771eef6..0a693dd9b7 100644 --- a/ext/standard/tests/directory/DirectoryClass_error_001.phpt +++ b/ext/standard/tests/directory/DirectoryClass_error_001.phpt @@ -17,12 +17,6 @@ var_dump($d->read()); var_dump($d->rewind()); var_dump($d->close()); -echo "\n--> Try all methods with wrong number of args:\n"; -$d = new Directory(getcwd()); -var_dump($d->read(1,2)); -var_dump($d->rewind(1,2)); -var_dump($d->close(1,2)); - ?> --EXPECTF-- --> Try all methods with bad handle: @@ -46,14 +40,3 @@ bool(false) Warning: Directory::close(): Unable to find my handle property in %s on line %d bool(false) - ---> Try all methods with wrong number of args: - -Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d -NULL 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/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/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_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 0da1fc69aa..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") ); @@ -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) 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/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 diff --git a/ext/standard/tests/filters/001.phpt b/ext/standard/tests/filters/001.phpt index fbfdda2385..53d9fc2b50 100644 --- a/ext/standard/tests/filters/001.phpt +++ b/ext/standard/tests/filters/001.phpt @@ -7,8 +7,6 @@ var_dump(stream_filter_register("", "")); var_dump(stream_filter_register("test", "")); var_dump(stream_filter_register("", "test")); var_dump(stream_filter_register("------", "nonexistentclass")); -var_dump(stream_filter_register(array(), "aa")); -var_dump(stream_filter_register("", array())); echo "Done\n"; ?> @@ -22,10 +20,4 @@ bool(false) Warning: stream_filter_register(): Filter name cannot be empty in %s on line %d bool(false) bool(true) - -Warning: stream_filter_register() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: stream_filter_register() expects parameter 2 to be string, array given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/filters/stream_filter_remove_error.phpt b/ext/standard/tests/filters/stream_filter_remove_error.phpt index 37820a99c4..e389b20fd8 100644 --- a/ext/standard/tests/filters/stream_filter_remove_error.phpt +++ b/ext/standard/tests/filters/stream_filter_remove_error.phpt @@ -20,16 +20,6 @@ $filter = stream_filter_append( $fp, "string.rot13", STREAM_FILTER_WRITE ); echo "*** Testing stream_filter_remove() : error conditions ***\n"; -echo "\n-- Testing stream_filter_remove() function with Zero arguments --\n"; -var_dump( stream_filter_remove() ); - -echo "\n-- Testing stream_filter_remove() function with more than expected no. of arguments --\n"; -$arg = 'bogus arg'; -var_dump( stream_filter_remove( $filter, $arg ) ); - -echo "\n-- Testing stream_filter_remove() function with unexisting stream filter --\n"; -var_dump( stream_filter_remove( "fakefilter" ) ); - echo "\n-- Testing stream_filter_remove() function with bad resource --\n"; var_dump( stream_filter_remove( $fp ) ); @@ -52,21 +42,6 @@ unlink( $file ); --EXPECTF-- *** Testing stream_filter_remove() : error conditions *** --- Testing stream_filter_remove() function with Zero arguments -- - -Warning: stream_filter_remove() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing stream_filter_remove() function with more than expected no. of arguments -- - -Warning: stream_filter_remove() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - --- Testing stream_filter_remove() function with unexisting stream filter -- - -Warning: stream_filter_remove() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -- Testing stream_filter_remove() function with bad resource -- Warning: stream_filter_remove(): Invalid resource given, not a stream filter in %s on line %d diff --git a/ext/standard/tests/general_functions/bug41970.phpt b/ext/standard/tests/general_functions/bug41970.phpt index 6f05137afc..f43bf64380 100644 --- a/ext/standard/tests/general_functions/bug41970.phpt +++ b/ext/standard/tests/general_functions/bug41970.phpt @@ -6,22 +6,26 @@ Bug #41970 (call_user_func_*() leaks on failure) $a = array(4,3,2); var_dump(call_user_func_array("sort", array($a))); -var_dump(call_user_func_array("strlen", array($a))); +try { + var_dump(call_user_func_array("strlen", array($a))); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(call_user_func("sort", $a)); -var_dump(call_user_func("strlen", $a)); +try { + var_dump(call_user_func("strlen", $a)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> --EXPECTF-- -Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 5 +Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line %d bool(true) +strlen() expects parameter 1 to be string, array given -Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 6 -NULL - -Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 7 +Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line %d bool(true) - -Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 8 -NULL +strlen() expects parameter 1 to be string, array given Done diff --git a/ext/standard/tests/general_functions/callbacks_001.phpt b/ext/standard/tests/general_functions/callbacks_001.phpt index a58f19d932..76d0e94c82 100644 --- a/ext/standard/tests/general_functions/callbacks_001.phpt +++ b/ext/standard/tests/general_functions/callbacks_001.phpt @@ -69,7 +69,11 @@ class P extends O { $this->call(array('parent', 'who')); $this->call(array('P', 'parent::who')); $this->call(array($this, 'O::who')); - $this->call(array($this, 'B::who')); + try { + $this->call(array($this, 'B::who')); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } } @@ -103,6 +107,5 @@ O $this|O::who O $this|B::who - -Warning: call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B' in %s on line %d +call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B' ===DONE=== diff --git a/ext/standard/tests/general_functions/callbacks_002.phpt b/ext/standard/tests/general_functions/callbacks_002.phpt index 22130c524a..0d44035e0e 100644 --- a/ext/standard/tests/general_functions/callbacks_002.phpt +++ b/ext/standard/tests/general_functions/callbacks_002.phpt @@ -3,14 +3,24 @@ call_user_func(): Wrong parameters --FILE-- <?php -call_user_func(array('Foo', 'bar')); -call_user_func(array(NULL, 'bar')); -call_user_func(array('stdclass', NULL)); +try { + call_user_func(array('Foo', 'bar')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + call_user_func(array(NULL, 'bar')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + call_user_func(array('stdclass', NULL)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- -Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Foo' not found in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method in %s on line %d +call_user_func() expects parameter 1 to be a valid callback, class 'Foo' not found +call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object +call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method diff --git a/ext/standard/tests/general_functions/error_get_last.phpt b/ext/standard/tests/general_functions/error_get_last.phpt index 71f068f104..e6cea73f4d 100644 --- a/ext/standard/tests/general_functions/error_get_last.phpt +++ b/ext/standard/tests/general_functions/error_get_last.phpt @@ -4,7 +4,11 @@ error_get_last() tests <?php var_dump(error_get_last()); -var_dump(error_get_last(true)); +try { + var_dump(error_get_last(true)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(error_get_last()); $a = $b; @@ -15,19 +19,8 @@ echo "Done\n"; ?> --EXPECTF-- NULL - -Warning: error_get_last() expects exactly 0 parameters, 1 given in %s on line %d +error_get_last() expects exactly 0 parameters, 1 given NULL -array(4) { - ["type"]=> - int(2) - ["message"]=> - string(54) "error_get_last() expects exactly 0 parameters, 1 given" - ["file"]=> - string(%i) "%s" - ["line"]=> - int(4) -} Notice: Undefined variable: b in %s on line %d array(4) { @@ -38,6 +31,6 @@ array(4) { ["file"]=> string(%i) "%s" ["line"]=> - int(7) + int(11) } Done diff --git a/ext/standard/tests/general_functions/floatval.phpt b/ext/standard/tests/general_functions/floatval.phpt index 1bb4d1151c..2b681e631d 100644 --- a/ext/standard/tests/general_functions/floatval.phpt +++ b/ext/standard/tests/general_functions/floatval.phpt @@ -91,18 +91,6 @@ foreach ($not_float_types as $type ) { var_dump( doubleval($type) ); } - - - -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( floatval() ); -var_dump( doubleval() ); - -//arguments more than expected -var_dump( floatval(TRUE, FALSE) ); -var_dump( doubleval(TRUE, FALSE) ); - echo "\nDone\n"; @@ -194,18 +182,4 @@ float(1) float(0) float(0) -*** Testing error conditions *** - -Warning: floatval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: doubleval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: floatval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: doubleval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt index 33d4af03d2..c74e4f71fe 100644 --- a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt +++ b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt @@ -14,10 +14,14 @@ $result = get_extension_funcs("standard"); var_dump(gettype($result)); var_dump(in_array("cos", $result)); +// Unknown extension +var_dump(get_extension_funcs("foo")); + ?> ===DONE=== --EXPECT-- Simple testcase for get_extension_funcs() function string(5) "array" bool(true) +bool(false) ===DONE=== diff --git a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt b/ext/standard/tests/general_functions/get_extension_funcs_error.phpt deleted file mode 100644 index 44bd822d12..0000000000 --- a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Test get_extension_funcs() function : error conditions ---FILE-- -<?php -/* Prototype : array get_extension_funcs ( string $module_name ) - * Description: Returns an array with the names of the functions of a module. - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -echo "*** Testing get_extension_funcs() : error conditions ***\n"; - -echo "\n-- Too few arguments --\n"; -var_dump(get_extension_funcs()); - -$extra_arg = 1; -echo "\n-- Too many arguments --\n"; -var_dump(get_extension_funcs("standard", $extra_arg)); - -echo "\n-- Invalid extension name --\n"; -var_dump(get_extension_funcs("foo")); - -?> -===DONE=== ---EXPECTF-- -*** Testing get_extension_funcs() : error conditions *** - --- Too few arguments -- - -Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Too many arguments -- - -Warning: get_extension_funcs() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Invalid extension name -- -bool(false) -===DONE=== diff --git a/ext/standard/tests/general_functions/get_include_path_basic.phpt b/ext/standard/tests/general_functions/get_include_path_basic.phpt index 2017bf697a..5b45c86449 100644 --- a/ext/standard/tests/general_functions/get_include_path_basic.phpt +++ b/ext/standard/tests/general_functions/get_include_path_basic.phpt @@ -19,19 +19,10 @@ if (ini_get("include_path") == get_include_path()) { echo "FAILED\n"; } -echo "\nError cases:\n"; -var_dump(get_include_path(TRUE)); - - ?> ===DONE=== --EXPECTF-- *** Testing get_include_path() string(1) "." PASSED - -Error cases: - -Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/get_included_files.phpt b/ext/standard/tests/general_functions/get_included_files.phpt index e6d00a56a1..e4dfe0f974 100644 --- a/ext/standard/tests/general_functions/get_included_files.phpt +++ b/ext/standard/tests/general_functions/get_included_files.phpt @@ -22,9 +22,6 @@ include(dirname(__FILE__)."/get_included_files_inc2.inc"); echo "\n-- List included files atfter including inc2 which will include inc3 which includes inc1 --\n"; var_dump(get_included_files()); -echo "\n-- Error cases --\n"; -var_dump(get_included_files(true)); - ?> ===DONE=== --EXPECTF-- @@ -55,9 +52,4 @@ array(4) { [3]=> string(%d) "%sget_included_files_inc3.inc" } - --- Error cases -- - -Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/getrusage.phpt b/ext/standard/tests/general_functions/getrusage.phpt index 4caca88e1b..8ec131809f 100644 --- a/ext/standard/tests/general_functions/getrusage.phpt +++ b/ext/standard/tests/general_functions/getrusage.phpt @@ -8,16 +8,12 @@ getrusage() tests var_dump(gettype(getrusage())); var_dump(gettype(getrusage(1))); var_dump(gettype(getrusage(-1))); -var_dump(getrusage(array())); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- string(5) "array" string(5) "array" string(5) "array" - -Warning: getrusage() expects parameter 1 to be int, array given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/getservbyport_variation1.phpt b/ext/standard/tests/general_functions/getservbyport_variation1.phpt index a876ac1fea..f387161bf4 100644 --- a/ext/standard/tests/general_functions/getservbyport_variation1.phpt +++ b/ext/standard/tests/general_functions/getservbyport_variation1.phpt @@ -12,29 +12,13 @@ Simone Gentili (sensorario@gmail.com) var_dump(getservbyport( -1, "tcp" )); var_dump(getservbyport( 80, "ppp" )); var_dump(getservbyport( null, null)); - var_dump(getservbyport( array(), array())); - var_dump(getservbyport( array(80), array("tcp"))); - var_dump(getservbyport( array(2, 3), array("one"=>1, "two"=>2))); var_dump(getservbyport( 2, 2)); var_dump(getservbyport( "80", "tcp")); - var_dump(getservbyport( new stdClass(), new stdClass())); ?> --EXPECTF-- bool(false) bool(false) bool(false) - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL bool(false) string(%d) "%s" - -Warning: getservbyport() expects parameter 1 to be int, object given in %s on line %d -NULL diff --git a/ext/standard/tests/general_functions/gettype_settype_error.phpt b/ext/standard/tests/general_functions/gettype_settype_error.phpt index 325e91e47f..e204c64d4c 100644 --- a/ext/standard/tests/general_functions/gettype_settype_error.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_error.phpt @@ -13,19 +13,7 @@ Test gettype() & settype() functions : error conditions echo "**** Testing gettype() and settype() functions ****\n"; -echo "\n*** Testing gettype(): error conditions ***\n"; -//Zero arguments -var_dump( gettype() ); -// args more than expected -var_dump( gettype( "1", "2" ) ); - echo "\n*** Testing settype(): error conditions ***\n"; -//Zero arguments -var_dump( settype() ); - -// args more than expected -$var = 10.5; -var_dump( settype( $var, $var, "int" ) ); // passing an invalid type to set var_dump( settype( $var, "unknown" ) ); @@ -35,22 +23,8 @@ echo "Done\n"; --EXPECTF-- **** Testing gettype() and settype() functions **** -*** Testing gettype(): error conditions *** - -Warning: gettype() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: gettype() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing settype(): error conditions *** -Warning: settype() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: settype() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: settype(): Invalid type in %s on line %d bool(false) Done diff --git a/ext/standard/tests/general_functions/include_path.phpt b/ext/standard/tests/general_functions/include_path.phpt index 8b6626fbc8..de6aa278eb 100644 --- a/ext/standard/tests/general_functions/include_path.phpt +++ b/ext/standard/tests/general_functions/include_path.phpt @@ -6,14 +6,9 @@ include_path=. <?php var_dump(get_include_path()); -var_dump(get_include_path("var")); var_dump(restore_include_path()); -var_dump(restore_include_path("")); - -var_dump(set_include_path()); -var_dump(get_include_path()); var_dump(set_include_path("var")); var_dump(get_include_path()); @@ -32,9 +27,6 @@ var_dump(get_include_path()); var_dump(restore_include_path()); var_dump(get_include_path()); -var_dump(set_include_path(array())); -var_dump(get_include_path()); - var_dump(restore_include_path()); var_dump(get_include_path()); @@ -43,18 +35,8 @@ echo "Done\n"; ?> --EXPECTF-- string(1) "." - -Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL -NULL - -Warning: restore_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: set_include_path() expects exactly 1 parameter, 0 given in %s on line %d NULL string(1) "." -string(1) "." string(3) "var" NULL string(1) "." @@ -66,10 +48,6 @@ bool(false) string(1) "." NULL string(1) "." - -Warning: set_include_path() expects parameter 1 to be a valid path, array given in %s on line %d -NULL -string(1) "." NULL string(1) "." Done diff --git a/ext/standard/tests/general_functions/intval.phpt b/ext/standard/tests/general_functions/intval.phpt index 7f3d895fbe..00b2dc04ab 100644 --- a/ext/standard/tests/general_functions/intval.phpt +++ b/ext/standard/tests/general_functions/intval.phpt @@ -146,13 +146,6 @@ foreach ($not_int_types as $type ) { var_dump( intval($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( intval() ); - -//arguments more than expected -var_dump( intval(TRUE, FALSE, TRUE) ); - echo "\n--- Done ---\n"; @@ -295,12 +288,4 @@ int(0) int(0) int(0) -*** Testing error conditions *** - -Warning: intval() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: intval() expects at most 2 parameters, 3 given in %s on line %d -NULL - --- Done --- diff --git a/ext/standard/tests/general_functions/is_array.phpt b/ext/standard/tests/general_functions/is_array.phpt index 223b732904..f3b0c75db3 100644 --- a/ext/standard/tests/general_functions/is_array.phpt +++ b/ext/standard/tests/general_functions/is_array.phpt @@ -98,13 +98,6 @@ foreach ($varient_arrays as $type ) { var_dump( is_array ($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_array() ); - -//arguments more than expected -var_dump( is_array ($fp, $fp) ); - echo "Done\n"; /* close resources */ fclose($fp); @@ -202,12 +195,4 @@ bool(false) bool(false) -- Iteration 29 -- bool(false) - -*** Testing error conditions *** - -Warning: is_array() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_array() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_bool.phpt b/ext/standard/tests/general_functions/is_bool.phpt index a6c6111fa1..4f0ae4fff5 100644 --- a/ext/standard/tests/general_functions/is_bool.phpt +++ b/ext/standard/tests/general_functions/is_bool.phpt @@ -127,13 +127,6 @@ foreach ($not_bool_types as $type ) { var_dump( is_bool($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_bool() ); - -//arguments more than expected -var_dump( is_bool(TRUE, FALSE) ); - echo "Done\n"; // close resources @@ -283,12 +276,4 @@ bool(false) bool(false) -- Iteration 65 -- bool(false) - -*** Testing error conditions *** - -Warning: is_bool() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_bool() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_countable_with_variables.phpt b/ext/standard/tests/general_functions/is_countable_with_variables.phpt index 700077ef17..0cb18769d6 100644 --- a/ext/standard/tests/general_functions/is_countable_with_variables.phpt +++ b/ext/standard/tests/general_functions/is_countable_with_variables.phpt @@ -7,7 +7,6 @@ Gabriel Caruso (carusogabriel34@gmail.com) var_dump(is_countable([1, 2, 3])); var_dump(is_countable((array) 1)); var_dump(is_countable((object) ['foo', 'bar', 'baz'])); -var_dump(is_countable()); $foo = ['', []]; @@ -24,9 +23,6 @@ if (!is_countable($bar)) { bool(true) bool(true) bool(false) - -Warning: is_countable() expects exactly 1 parameter, 0 given in %s on line %d -NULL int(2) Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d diff --git a/ext/standard/tests/general_functions/is_float.phpt b/ext/standard/tests/general_functions/is_float.phpt index b71a5283db..0ee1c60959 100644 --- a/ext/standard/tests/general_functions/is_float.phpt +++ b/ext/standard/tests/general_functions/is_float.phpt @@ -127,17 +127,6 @@ foreach ($not_floats as $value ) { var_dump( is_real($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_float() ); -var_dump( is_double() ); -var_dump( is_real() ); - -//arguments more than expected -var_dump( is_float( $floats[0], $floats[1]) ); -var_dump( is_double( $floats[0], $floats[1]) ); -var_dump( is_real( $floats[0], $floats[1]) ); - echo "Done\n"; // close the resources used @@ -417,24 +406,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_float_64bit.phpt b/ext/standard/tests/general_functions/is_float_64bit.phpt index 9410a21fe2..76cbf0c5d2 100644 --- a/ext/standard/tests/general_functions/is_float_64bit.phpt +++ b/ext/standard/tests/general_functions/is_float_64bit.phpt @@ -129,17 +129,6 @@ foreach ($not_floats as $value ) { var_dump( is_real($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_float() ); -var_dump( is_double() ); -var_dump( is_real() ); - -//arguments more than expected -var_dump( is_float( $floats[0], $floats[1]) ); -var_dump( is_double( $floats[0], $floats[1]) ); -var_dump( is_real( $floats[0], $floats[1]) ); - echo "Done\n"; ?> --EXPECTF-- @@ -414,24 +403,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_int.phpt b/ext/standard/tests/general_functions/is_int.phpt index d154b30748..2f452cd48b 100644 --- a/ext/standard/tests/general_functions/is_int.phpt +++ b/ext/standard/tests/general_functions/is_int.phpt @@ -132,17 +132,6 @@ foreach ($not_int_types as $type ) { var_dump( is_long($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_int() ); -var_dump( is_integer() ); -var_dump( is_long() ); - -//arguments more than expected -var_dump( is_int(TRUE, FALSE) ); -var_dump( is_integer(TRUE, FALSE) ); -var_dump( is_long(TRUE, FALSE) ); - echo "Done\n"; // close the resources @@ -442,24 +431,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_int_64bit.phpt b/ext/standard/tests/general_functions/is_int_64bit.phpt index 68ef75b35b..ac919ced16 100644 --- a/ext/standard/tests/general_functions/is_int_64bit.phpt +++ b/ext/standard/tests/general_functions/is_int_64bit.phpt @@ -134,17 +134,6 @@ foreach ($not_int_types as $type ) { var_dump( is_long($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_int() ); -var_dump( is_integer() ); -var_dump( is_long() ); - -//arguments more than expected -var_dump( is_int(TRUE, FALSE) ); -var_dump( is_integer(TRUE, FALSE) ); -var_dump( is_long(TRUE, FALSE) ); - echo "Done\n"; ?> --EXPECTF-- @@ -439,24 +428,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_null.phpt b/ext/standard/tests/general_functions/is_null.phpt index fa7c87f791..5a3269a28a 100644 --- a/ext/standard/tests/general_functions/is_null.phpt +++ b/ext/standard/tests/general_functions/is_null.phpt @@ -127,13 +127,6 @@ foreach ($not_null_types as $type ) { var_dump( is_null($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_null() ); - -//arguments more than expected -var_dump( is_null(NULL, null) ); - echo "Done\n"; // close the resources used @@ -285,12 +278,4 @@ bool(false) bool(false) -- Iteration 59 -- bool(false) - -*** Testing error conditions *** - -Warning: is_null() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_null() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_numeric.phpt b/ext/standard/tests/general_functions/is_numeric.phpt index 0019cf18d2..509ee7e686 100644 --- a/ext/standard/tests/general_functions/is_numeric.phpt +++ b/ext/standard/tests/general_functions/is_numeric.phpt @@ -145,13 +145,6 @@ foreach ($not_numerics as $type ) { var_dump( is_numeric($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_numeric() ); - -//arguments more than expected -var_dump( is_numeric("10", "20") ); - echo "Done\n"; // close the resources used @@ -373,12 +366,4 @@ bool(false) bool(false) -- Iteration 29 -- bool(false) - -*** Testing error conditions *** - -Warning: is_numeric() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/is_object.phpt b/ext/standard/tests/general_functions/is_object.phpt index 8abc766376..2b5d1ae475 100644 --- a/ext/standard/tests/general_functions/is_object.phpt +++ b/ext/standard/tests/general_functions/is_object.phpt @@ -138,13 +138,6 @@ foreach ($not_objects as $type ) { var_dump( is_object($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_object() ); - -//arguments more than expected -var_dump( is_object($myClass_object, $myClass_object) ); - echo "Done\n"; // close the resources used @@ -216,12 +209,4 @@ bool(false) bool(false) -- Iteration 19 -- bool(false) - -*** Testing error conditions *** - -Warning: is_object() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_object() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_scalar.phpt b/ext/standard/tests/general_functions/is_scalar.phpt index 53620178c4..f7ef3f5317 100644 --- a/ext/standard/tests/general_functions/is_scalar.phpt +++ b/ext/standard/tests/general_functions/is_scalar.phpt @@ -105,14 +105,6 @@ foreach( $variation_array as $value ) { var_dump( is_scalar($value) ); } -echo "\n*** Testing error conditions ***\n"; -// Zero arguments -var_dump( is_scalar() ); - -// Arguments more than expected -var_dump( is_scalar( $scalar_variables[2], $scalar_variables[2]) ); -var_dump( is_scalar( new stdclass, new stdclass) ); - echo "Done\n"; // close the resources used @@ -226,15 +218,4 @@ bool(false) bool(false) -- Iteration 18 -- bool(false) - -*** Testing error conditions *** - -Warning: is_scalar() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/is_string.phpt b/ext/standard/tests/general_functions/is_string.phpt index 72a885a57a..d48fbd1729 100644 --- a/ext/standard/tests/general_functions/is_string.phpt +++ b/ext/standard/tests/general_functions/is_string.phpt @@ -140,13 +140,6 @@ foreach ($not_strings as $type ) { var_dump( is_string($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_string() ); - -//arguments more than expected -var_dump( is_string("string", "test") ); - echo "Done\n"; // close the resources used @@ -292,12 +285,4 @@ bool(false) bool(false) -- Iteration 45 -- bool(false) - -*** Testing error conditions *** - -Warning: is_string() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_string() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/ob_get_flush_error.phpt b/ext/standard/tests/general_functions/ob_get_flush_error.phpt index 0664043eba..5603e3d238 100644 --- a/ext/standard/tests/general_functions/ob_get_flush_error.phpt +++ b/ext/standard/tests/general_functions/ob_get_flush_error.phpt @@ -12,10 +12,6 @@ output_buffering=0 echo "*** Testing ob_get_flush() : error conditions ***\n"; -// One extra argument -$extra_arg = 10; -var_dump( ob_get_flush( $extra_arg ) ); - // No ob_start() executed var_dump( ob_get_flush() ); @@ -24,9 +20,6 @@ var_dump( ob_get_flush() ); --EXPECTF-- *** Testing ob_get_flush() : error conditions *** -Warning: ob_get_flush() expects exactly 0 parameters, 1 given in %s on line %d -NULL - Notice: ob_get_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/general_functions/ob_get_length_basic.phpt b/ext/standard/tests/general_functions/ob_get_length_basic.phpt index b3470bec55..75e22e7741 100644 --- a/ext/standard/tests/general_functions/ob_get_length_basic.phpt +++ b/ext/standard/tests/general_functions/ob_get_length_basic.phpt @@ -31,9 +31,6 @@ dump_string_length( ' lsf' ); dump_string_length( '' ); dump_string_length( null ); -// Extra argument -var_dump( ob_get_length( 'foobar' ) ); - ?> ===DONE=== --EXPECTF-- @@ -45,7 +42,4 @@ int(1) int(15) int(0) int(0) - -Warning: ob_get_length() expects exactly 0 parameters, 1 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/parse_ini_file.phpt b/ext/standard/tests/general_functions/parse_ini_file.phpt index ebc714455d..14c1fc18ef 100644 --- a/ext/standard/tests/general_functions/parse_ini_file.phpt +++ b/ext/standard/tests/general_functions/parse_ini_file.phpt @@ -8,8 +8,6 @@ parse_ini_file() multiple calls $filename = dirname(__FILE__)."/parse_ini_file.dat"; @unlink($filename); /* Make sure the file really does not exist! */ -var_dump(parse_ini_file()); -var_dump(parse_ini_file(1,1,1,1)); var_dump(parse_ini_file($filename)); var_dump(parse_ini_file($filename, true)); @@ -121,16 +119,10 @@ var_dump(parse_ini_file($filename, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: parse_ini_file() expects at least 1 parameter, 0 given in %sparse_ini_file.php on line 6 +Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line %d bool(false) -Warning: parse_ini_file() expects at most 3 parameters, 4 given in %sparse_ini_file.php on line 7 -bool(false) - -Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 8 -bool(false) - -Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 9 +Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line %d bool(false) array(1) { ["test"]=> @@ -138,11 +130,11 @@ array(1) { } Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2 - in %sparse_ini_file.php on line 20 + in %sparse_ini_file.php on line %d bool(false) Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2 - in %sparse_ini_file.php on line 26 + in %sparse_ini_file.php on line %d bool(false) array(1) { ["test"]=> diff --git a/ext/standard/tests/general_functions/parse_ini_string_002.phpt b/ext/standard/tests/general_functions/parse_ini_string_002.phpt index 106cd0c842..384398cdb2 100644 --- a/ext/standard/tests/general_functions/parse_ini_string_002.phpt +++ b/ext/standard/tests/general_functions/parse_ini_string_002.phpt @@ -3,9 +3,6 @@ parse_ini_string() multiple calls --FILE-- <?php -var_dump(parse_ini_string()); -var_dump(parse_ini_string(1,1,1,1)); - $ini = " test = "; @@ -87,11 +84,6 @@ var_dump(parse_ini_string($ini, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: parse_ini_string() expects at least 1 parameter, 0 given in %s -bool(false) - -Warning: parse_ini_string() expects at most 3 parameters, 4 given in %s -bool(false) array(1) { ["test"]=> string(0) "" diff --git a/ext/standard/tests/general_functions/php_uname_error.phpt b/ext/standard/tests/general_functions/php_uname_error.phpt index 392e1c930e..ec5b2b5839 100644 --- a/ext/standard/tests/general_functions/php_uname_error.phpt +++ b/ext/standard/tests/general_functions/php_uname_error.phpt @@ -8,49 +8,15 @@ Test php_uname() function - error conditions - pass function incorrect argument echo "*** Testing php_uname() - error test\n"; -echo "\n-- Testing php_uname() function with more than expected no. of arguments --\n"; -var_dump( php_uname('a', true) ); - echo "\n-- Testing php_uname() function with invalid mode --\n"; // am invalid mode should result in same o/p as mode 'a' var_dump( php_uname('z') == php_uname('z') ); -class barClass { -} - -$fp = fopen(__FILE__, "r"); - -echo "\n-- Testing php_uname() function with invalid argument types --\n"; -var_dump(php_uname(array())); -var_dump(php_uname(array('color' => 'red', 'item' => 'pen'))); -var_dump(php_uname(new barClass())); -var_dump(php_uname($fp)); - -fclose($fp); ?> ===DONE=== --EXPECTF-- *** Testing php_uname() - error test --- Testing php_uname() function with more than expected no. of arguments -- - -Warning: php_uname() expects at most 1 parameter, 2 given in %s on line %d -NULL - -- Testing php_uname() function with invalid mode -- bool(true) - --- Testing php_uname() function with invalid argument types -- - -Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, resource given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/phpcredits.phpt b/ext/standard/tests/general_functions/phpcredits.phpt index 044232570e..dfcddc61f3 100644 --- a/ext/standard/tests/general_functions/phpcredits.phpt +++ b/ext/standard/tests/general_functions/phpcredits.phpt @@ -4,7 +4,6 @@ phpcredits() <?php var_dump(phpcredits()); -var_dump(phpcredits(array())); echo "--\n"; var_dump(phpcredits(0)); @@ -40,9 +39,6 @@ PHP Quality Assurance Team %wWebsites and Infrastructure team%w %a bool(true) - -Warning: phpcredits() expects parameter 1 to be int, array given in %sphpcredits.php on line 4 -NULL -- PHP Credits bool(true) diff --git a/ext/standard/tests/general_functions/phpcredits2.phpt b/ext/standard/tests/general_functions/phpcredits2.phpt index 9966f23a96..6aa023e919 100644 --- a/ext/standard/tests/general_functions/phpcredits2.phpt +++ b/ext/standard/tests/general_functions/phpcredits2.phpt @@ -6,7 +6,6 @@ dummy=x <?php var_dump(phpcredits()); -var_dump(phpcredits(array())); echo "--\n"; var_dump(phpcredits(0)); @@ -18,9 +17,6 @@ var_dump(phpcredits(CREDITS_GROUP)); --EXPECTF-- <!DOCTYPE %a>%s</html> bool(true) - -Warning: phpcredits() expects parameter 1 to be int, array given in %sphpcredits2.php on line 4 -NULL -- <h1>PHP Credits</h1> bool(true) diff --git a/ext/standard/tests/general_functions/phpinfo.phpt b/ext/standard/tests/general_functions/phpinfo.phpt index a805876aab..5f4d99ffba 100644 --- a/ext/standard/tests/general_functions/phpinfo.phpt +++ b/ext/standard/tests/general_functions/phpinfo.phpt @@ -5,9 +5,6 @@ phpinfo() var_dump(phpinfo()); echo "--\n"; -var_dump(phpinfo(array())); - -echo "--\n"; var_dump(phpinfo(0)); echo "--\n"; @@ -62,10 +59,6 @@ PHP License %A bool(true) -- - -Warning: phpinfo() expects parameter 1 to be int, array given in %sphpinfo.php on line 5 -NULL --- phpinfo() bool(true) -- diff --git a/ext/standard/tests/general_functions/phpinfo2.phpt b/ext/standard/tests/general_functions/phpinfo2.phpt index f422f923d9..5a36aa9d28 100644 --- a/ext/standard/tests/general_functions/phpinfo2.phpt +++ b/ext/standard/tests/general_functions/phpinfo2.phpt @@ -7,9 +7,6 @@ dummy=x var_dump(phpinfo()); echo "--\n"; -var_dump(phpinfo(array())); - -echo "--\n"; var_dump(phpinfo(0)); echo "--\n"; @@ -20,10 +17,6 @@ var_dump(phpinfo(INFO_LICENSE)); <!DOCTYPE %s> %a</html>bool(true) -- - -Warning: phpinfo() expects parameter 1 to be int, array given in %sphpinfo2.php on line 5 -NULL --- <!DOCTYPE %s> %a</html>bool(true) -- diff --git a/ext/standard/tests/general_functions/print_r.phpt b/ext/standard/tests/general_functions/print_r.phpt index de58dd1e1e..15155fe0d2 100644 --- a/ext/standard/tests/general_functions/print_r.phpt +++ b/ext/standard/tests/general_functions/print_r.phpt @@ -271,16 +271,6 @@ $misc_values = array ( /* calling check_printr() to display miscelleneous data using print_r() */ check_printr($misc_values); -echo "\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump( print_r() ); - -//passing more than required no. of arguments -var_dump( print_r(123, true, "abc") ); - -// check when second arg is given other than boolean TRUE -var_dump( print_r ($value, "string") ); - /* closing resource handle used */ closedir($dir_handle); @@ -1706,15 +1696,4 @@ Array -- Iteration 4 -- - -*** Testing error conditions *** - -Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - -Notice: Undefined variable: value in %s on line %d -string(0) "" Done diff --git a/ext/standard/tests/general_functions/print_r_64bit.phpt b/ext/standard/tests/general_functions/print_r_64bit.phpt index ff9c3c0b9c..db5b92bf84 100644 --- a/ext/standard/tests/general_functions/print_r_64bit.phpt +++ b/ext/standard/tests/general_functions/print_r_64bit.phpt @@ -275,16 +275,6 @@ $misc_values = array ( /* calling check_printr() to display miscelleneous data using print_r() */ check_printr($misc_values); -echo "\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump( print_r() ); - -//passing more than required no. of arguments -var_dump( print_r(123, true, "abc") ); - -// check when second arg is given other than boolean TRUE -var_dump( print_r ($value, "string") ); - /* closing resource handle used */ closedir($dir_handle); @@ -1710,15 +1700,4 @@ Array -- Iteration 4 -- - -*** Testing error conditions *** - -Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - -Notice: Undefined variable: value in %s on line %d -string(0) "" Done diff --git a/ext/standard/tests/general_functions/rand.phpt b/ext/standard/tests/general_functions/rand.phpt index e6639a71c7..73dec4eb75 100644 --- a/ext/standard/tests/general_functions/rand.phpt +++ b/ext/standard/tests/general_functions/rand.phpt @@ -4,60 +4,36 @@ rand() and mt_rand() tests <?php var_dump(mt_rand()); -var_dump(mt_rand(-1)); var_dump(mt_rand(-1,1)); var_dump(mt_rand(0,3)); var_dump(rand()); -var_dump(rand(-1)); var_dump(rand(-1,1)); var_dump(rand(0,3)); var_dump(srand()); var_dump(srand(-1)); -var_dump(srand(array())); var_dump(mt_srand()); var_dump(mt_srand(-1)); -var_dump(mt_srand(array())); var_dump(getrandmax()); -var_dump(getrandmax(1)); var_dump(mt_getrandmax()); -var_dump(mt_getrandmax(1)); echo "Done\n"; ?> --EXPECTF-- int(%d) - -Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line %d -NULL int(%i) int(%d) int(%d) - -Warning: rand() expects exactly 2 parameters, 1 given in %s on line %d -NULL int(%i) int(%d) NULL NULL - -Warning: srand() expects parameter 1 to be int, array given in %s on line %d -NULL -NULL NULL - -Warning: mt_srand() expects parameter 1 to be int, array given in %s on line %d NULL int(%d) - -Warning: getrandmax() expects exactly 0 parameters, 1 given in %s on line %d -NULL int(%d) - -Warning: mt_getrandmax() expects exactly 0 parameters, 1 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/sleep_error.phpt b/ext/standard/tests/general_functions/sleep_error.phpt index c4f069a3d2..3b46a35e5d 100644 --- a/ext/standard/tests/general_functions/sleep_error.phpt +++ b/ext/standard/tests/general_functions/sleep_error.phpt @@ -10,14 +10,6 @@ Test sleep() function : error conditions echo "*** Testing sleep() : error conditions ***\n"; -echo "\n-- Testing sleep() function with zero arguments --\n"; -var_dump( sleep() ); - -echo "\n-- Testing sleep() function with more than expected no. of arguments --\n"; -$seconds = 10; -$extra_arg = 10; -var_dump( sleep($seconds, $extra_arg) ); - echo "\n-- Testing sleep() function with negative interval --\n"; $seconds = -10; var_dump( sleep($seconds) ); @@ -27,16 +19,6 @@ var_dump( sleep($seconds) ); --EXPECTF-- *** Testing sleep() : error conditions *** --- Testing sleep() function with zero arguments -- - -Warning: sleep() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing sleep() function with more than expected no. of arguments -- - -Warning: sleep() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -- Testing sleep() function with negative interval -- Warning: sleep(): Number of seconds must be greater than or equal to 0 in %s on line %d diff --git a/ext/standard/tests/general_functions/strval.phpt b/ext/standard/tests/general_functions/strval.phpt index b814733dd0..0e513a3c47 100644 --- a/ext/standard/tests/general_functions/strval.phpt +++ b/ext/standard/tests/general_functions/strval.phpt @@ -141,13 +141,6 @@ foreach ($not_scalars as $value ) { var_dump( strval($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( strval() ); - -//arguments more than expected -var_dump( strval( $scalars[0], $scalars[1]) ); - echo "Done\n"; // close the resources used @@ -306,12 +299,4 @@ string(0) "" string(0) "" -- Iteration 11 -- string(0) "" - -*** Testing error conditions *** - -Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/sys_getloadavg.phpt b/ext/standard/tests/general_functions/sys_getloadavg.phpt index 5763084f70..1775978a12 100644 --- a/ext/standard/tests/general_functions/sys_getloadavg.phpt +++ b/ext/standard/tests/general_functions/sys_getloadavg.phpt @@ -7,14 +7,11 @@ if (!function_exists("sys_getloadavg")) die("skip"); --FILE-- <?php -var_dump(sys_getloadavg("")); var_dump(sys_getloadavg()); echo "Done\n"; ?> --EXPECTF-- -Warning: sys_getloadavg() expects exactly 0 parameters, %d given in %s -NULL array(3) { [0]=> float(%f) diff --git a/ext/standard/tests/general_functions/usleep_error.phpt b/ext/standard/tests/general_functions/usleep_error.phpt index 474aab7d5d..283e7f30e5 100644 --- a/ext/standard/tests/general_functions/usleep_error.phpt +++ b/ext/standard/tests/general_functions/usleep_error.phpt @@ -11,14 +11,6 @@ set_time_limit(20); echo "*** Testing usleep() : error conditions ***\n"; -echo "\n-- Testing usleep() function with zero arguments --\n"; -var_dump( usleep() ); - -echo "\n-- Testing usleep() function with more than expected no. of arguments --\n"; -$seconds = 10; -$extra_arg = 10; -var_dump( usleep($seconds, $extra_arg) ); - echo "\n-- Testing usleep() function with negative interval --\n"; $seconds = -10; var_dump( usleep($seconds) ); @@ -28,16 +20,6 @@ var_dump( usleep($seconds) ); --EXPECTF-- *** Testing usleep() : error conditions *** --- Testing usleep() function with zero arguments -- - -Warning: usleep() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing usleep() function with more than expected no. of arguments -- - -Warning: usleep() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -- Testing usleep() function with negative interval -- Warning: usleep(): Number of microseconds must be greater than or equal to 0 in %s on line %d diff --git a/ext/standard/tests/general_functions/var_dump.phpt b/ext/standard/tests/general_functions/var_dump.phpt index 74f497da65..5de84c531e 100644 --- a/ext/standard/tests/general_functions/var_dump.phpt +++ b/ext/standard/tests/general_functions/var_dump.phpt @@ -274,10 +274,6 @@ echo "\n*** Testing var_dump() on multiple arguments ***\n"; var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources, $objects, $misc_values, $variations ); -echo "\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump(); - /* closing resource handle used */ closedir($dir_handle); @@ -1553,8 +1549,4 @@ array(6) { string(5) "/00\7" } } - -*** Testing error conditions *** - -Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d Done diff --git a/ext/standard/tests/general_functions/var_dump_64bit.phpt b/ext/standard/tests/general_functions/var_dump_64bit.phpt index 8440ffaf6e..0815c9d62f 100644 --- a/ext/standard/tests/general_functions/var_dump_64bit.phpt +++ b/ext/standard/tests/general_functions/var_dump_64bit.phpt @@ -274,10 +274,6 @@ echo "\n*** Testing var_dump() on multiple arguments ***\n"; var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources, $objects, $misc_values, $variations ); -echo "\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump(); - /* closing resource handle used */ closedir($dir_handle); @@ -1553,8 +1549,4 @@ array(6) { string(5) "/00\7" } } - -*** Testing error conditions *** - -Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d Done diff --git a/ext/standard/tests/general_functions/var_export-locale.phpt b/ext/standard/tests/general_functions/var_export-locale.phpt index e8939f1d0a..52896eb788 100644 --- a/ext/standard/tests/general_functions/var_export-locale.phpt +++ b/ext/standard/tests/general_functions/var_export-locale.phpt @@ -300,14 +300,7 @@ echo "\n"; $counter++; } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_export( var_export() ); - -//arguments more than expected -var_export( var_export(TRUE, FALSE, TRUE) ); - -echo "\n\nDone"; +echo "\nDone"; ?> @@ -1135,11 +1128,4 @@ NULL string(4) "NULL" -*** Testing error conditions *** - -Warning: var_export() expects at least 1 parameter, 0 given in %s on line %d -NULL -Warning: var_export() expects at most 2 parameters, 3 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/image/image_type_to_extension.phpt b/ext/standard/tests/image/image_type_to_extension.phpt index 8418a4b8c7..249df57943 100644 --- a/ext/standard/tests/image/image_type_to_extension.phpt +++ b/ext/standard/tests/image/image_type_to_extension.phpt @@ -29,12 +29,8 @@ image_type_to_extension() printf("Constant: %s\n\tWith dot: %s\n\tWithout dot: %s\n", $name, image_type_to_extension($constant), image_type_to_extension($constant, false)); } - var_dump(image_type_to_extension(-1, array())); - var_dump(image_type_to_extension(new stdclass)); var_dump(image_type_to_extension(1000000, NULL)); - var_dump(image_type_to_extension()); var_dump(image_type_to_extension(0)); - var_dump(image_type_to_extension(0, 0, 0)); ?> Done --EXPECTF-- @@ -89,18 +85,6 @@ Constant: IMAGETYPE_XBM Constant: IMAGETYPE_WEBP With dot: .webp Without dot: webp - -Warning: image_type_to_extension() expects parameter 2 to be bool, array given in %s on line %d -bool(false) - -Warning: image_type_to_extension() expects parameter 1 to be int, object given in %s on line %d -bool(false) bool(false) - -Warning: image_type_to_extension() expects at least 1 parameter, 0 given in %s on line %d -bool(false) -bool(false) - -Warning: image_type_to_extension() expects at most 2 parameters, 3 given in %s on line %d bool(false) Done diff --git a/ext/standard/tests/math/acos_variation.phpt b/ext/standard/tests/math/acos_variation.phpt index 5575ec5796..4fe8437fd5 100644 --- a/ext/standard/tests/math/acos_variation.phpt +++ b/ext/standard/tests/math/acos_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(NAN) float(NAN) float(NAN) float(NAN) - -Warning: acos() expects parameter 1 to be float, string given in %s on line %d -NULL float(NAN) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/acosh_variation.phpt b/ext/standard/tests/math/acosh_variation.phpt index cc89ce3e76..12200e035c 100644 --- a/ext/standard/tests/math/acosh_variation.phpt +++ b/ext/standard/tests/math/acosh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(3.828168471) float(3.828168471) float(3.847562739) float(3.847562739) - -Warning: acosh() expects parameter 1 to be float, string given in %s on line %d -NULL float(7.60090221) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/asin_variation.phpt b/ext/standard/tests/math/asin_variation.phpt index c8063849fd..c5d170e8db 100644 --- a/ext/standard/tests/math/asin_variation.phpt +++ b/ext/standard/tests/math/asin_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(NAN) float(NAN) float(NAN) float(NAN) - -Warning: asin() expects parameter 1 to be float, string given in %s on line %d -NULL float(NAN) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/asinh_variation.phpt b/ext/standard/tests/math/asinh_variation.phpt index 5e41a45900..2470f7d401 100644 --- a/ext/standard/tests/math/asinh_variation.phpt +++ b/ext/standard/tests/math/asinh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(3.829113652) float(3.829113652) float(3.848471992) float(3.848471992) - -Warning: asinh() expects parameter 1 to be float, string given in %s on line %d -NULL float(7.60090271) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/atan_variation.phpt b/ext/standard/tests/math/atan_variation.phpt index b6a9a9ec32..625b6d0b83 100644 --- a/ext/standard/tests/math/atan_variation.phpt +++ b/ext/standard/tests/math/atan_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1.527345431) float(1.527345431) float(1.528178225) float(1.528178225) - -Warning: atan() expects parameter 1 to be float, string given in %s on line %d -NULL float(1.569796327) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/atanh_variation.phpt b/ext/standard/tests/math/atanh_variation.phpt index 2b0a4b1085..f14406bb0d 100644 --- a/ext/standard/tests/math/atanh_variation.phpt +++ b/ext/standard/tests/math/atanh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(NAN) float(NAN) float(NAN) float(NAN) - -Warning: atanh() expects parameter 1 to be float, string given in %s on line %d -NULL float(NAN) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/base_convert_error.phpt b/ext/standard/tests/math/base_convert_error.phpt index f27d0a66cf..7e1a12c8bc 100644 --- a/ext/standard/tests/math/base_convert_error.phpt +++ b/ext/standard/tests/math/base_convert_error.phpt @@ -14,30 +14,18 @@ class classA { } -echo "Incorrect number of arguments\n"; -base_convert(); -base_convert(35); -base_convert(35,2); +echo "Incorrect input\n"; base_convert(1234, 1, 10); base_convert(1234, 10, 37); - -echo "Incorrect input\n"; base_convert(new classA(), 8, 10); ?> --EXPECTF-- *** Testing base_convert() : error conditions *** -Incorrect number of arguments - -Warning: base_convert() expects exactly 3 parameters, 0 given in %s on line %d - -Warning: base_convert() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: base_convert() expects exactly 3 parameters, 2 given in %s on line %d +Incorrect input Warning: base_convert(): Invalid `from base' (1) in %s on line %d Warning: base_convert(): Invalid `to base' (37) in %s on line %d -Incorrect input Recoverable fatal error: Object of class classA could not be converted to string in %s on line %d diff --git a/ext/standard/tests/math/cos_variation.phpt b/ext/standard/tests/math/cos_variation.phpt index 6323042dc7..f9d1b26246 100644 --- a/ext/standard/tests/math/cos_variation.phpt +++ b/ext/standard/tests/math/cos_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(-0.5328330203) float(-0.5328330203) float(-0.1117112391) float(-0.1117112391) - -Warning: cos() expects parameter 1 to be float, string given in %s on line %d -NULL float(0.5623790763) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/cosh_variation.phpt b/ext/standard/tests/math/cosh_variation.phpt index cd64670668..ec58c0151f 100644 --- a/ext/standard/tests/math/cosh_variation.phpt +++ b/ext/standard/tests/math/cosh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(4872401723) float(4872401723) float(7641446995) float(7641446995) - -Warning: cosh() expects parameter 1 to be float, string given in %s on line %d -NULL float(INF) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/deg2rad_variation.phpt b/ext/standard/tests/math/deg2rad_variation.phpt index d5f6920ea7..eb3c7eae0e 100644 --- a/ext/standard/tests/math/deg2rad_variation.phpt +++ b/ext/standard/tests/math/deg2rad_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(0.401425728) float(0.401425728) float(0.4092797096) float(0.4092797096) - -Warning: deg2rad() expects parameter 1 to be float, string given in %s on line %d -NULL float(17.45329252) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/lcg_value_basic.phpt b/ext/standard/tests/math/lcg_value_basic.phpt index 44304f2475..7660f67c24 100644 --- a/ext/standard/tests/math/lcg_value_basic.phpt +++ b/ext/standard/tests/math/lcg_value_basic.phpt @@ -21,22 +21,6 @@ if ($i != 100) { echo "PASSED\n"; } -echo "\n lcg_value error cases..\n"; -$res = lcg_value(23); - -if (is_null($res)) { - echo "PASSED\n"; -} else { - echo "FAILED\n"; -} - -$res = lcg_value(10,false); -if (is_null($res)) { - echo "PASSED\n"; -} else { - echo "FAILED\n"; -} - echo "MATHS test script completed\n"; ?> @@ -45,12 +29,4 @@ MATHS test script started lcg_value tests... PASSED - - lcg_value error cases.. - -Warning: lcg_value() expects exactly 0 parameters, 1 given in %slcg_value_basic.php on line %d -PASSED - -Warning: lcg_value() expects exactly 0 parameters, 2 given in %slcg_value_basic.php on line %d -PASSED MATHS test script completed diff --git a/ext/standard/tests/math/log10_variation.phpt b/ext/standard/tests/math/log10_variation.phpt index 5304325952..8dbea47a84 100644 --- a/ext/standard/tests/math/log10_variation.phpt +++ b/ext/standard/tests/math/log10_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1.361727836) float(1.361727836) float(1.370142847) float(1.370142847) - -Warning: log10() expects parameter 1 to be float, string given in %s on line %d -NULL float(3) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/log_error.phpt b/ext/standard/tests/math/log_error.phpt index 48a23df3c0..7c305a4cba 100644 --- a/ext/standard/tests/math/log_error.phpt +++ b/ext/standard/tests/math/log_error.phpt @@ -4,13 +4,7 @@ Test log() - wrong params test log() precision=14 --FILE-- <?php -log(); -log(36,4,true); log(36, -4); ?> --EXPECTF-- -Warning: log() expects at least 1 parameter, 0 given in %s on line %d - -Warning: log() expects at most 2 parameters, 3 given in %s on line %d - Warning: log(): base must be greater than 0 in %s on line %d diff --git a/ext/standard/tests/math/rad2deg_variation.phpt b/ext/standard/tests/math/rad2deg_variation.phpt index 596a1940a4..6ea7d0c8a4 100644 --- a/ext/standard/tests/math/rad2deg_variation.phpt +++ b/ext/standard/tests/math/rad2deg_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1317.802929) float(1317.802929) float(1343.58603) float(1343.58603) - -Warning: rad2deg() expects parameter 1 to be float, string given in %s on line %d -NULL float(57295.77951) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/sin_variation.phpt b/ext/standard/tests/math/sin_variation.phpt index 5b635dfbdc..d044a16b40 100644 --- a/ext/standard/tests/math/sin_variation.phpt +++ b/ext/standard/tests/math/sin_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(-0.8462204042) float(-0.8462204042) float(-0.9937407102) float(-0.9937407102) - -Warning: sin() expects parameter 1 to be float, string given in %s on line %d -NULL float(0.8268795405) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/sinh_variation.phpt b/ext/standard/tests/math/sinh_variation.phpt index e47e94d629..5e576f447f 100644 --- a/ext/standard/tests/math/sinh_variation.phpt +++ b/ext/standard/tests/math/sinh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(4872401723) float(4872401723) float(7641446995) float(7641446995) - -Warning: sinh() expects parameter 1 to be float, string given in %s on line %d -NULL float(INF) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/sqrt_variation.phpt b/ext/standard/tests/math/sqrt_variation.phpt index 7369b98dfd..6e2304b437 100644 --- a/ext/standard/tests/math/sqrt_variation.phpt +++ b/ext/standard/tests/math/sqrt_variation.phpt @@ -22,7 +22,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -47,9 +46,6 @@ float(4.7958315233127) float(4.7958315233127) float(4.8425200051213) float(4.8425200051213) - -Warning: sqrt() expects parameter 1 to be float, string given in %s on line %d -NULL float(31.622776601684) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/tan_variation.phpt b/ext/standard/tests/math/tan_variation.phpt index 81546bbf6f..2c9ede4738 100644 --- a/ext/standard/tests/math/tan_variation.phpt +++ b/ext/standard/tests/math/tan_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1.588153083) float(1.588153083) float(8.895619796) float(8.895619796) - -Warning: tan() expects parameter 1 to be float, string given in %s on line %d -NULL float(1.470324156) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/tanh_variation.phpt b/ext/standard/tests/math/tanh_variation.phpt index b1b477c150..907f802b8a 100644 --- a/ext/standard/tests/math/tanh_variation.phpt +++ b/ext/standard/tests/math/tanh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1) float(1) float(1) float(1) - -Warning: tanh() expects parameter 1 to be float, string given in %s on line %d -NULL float(1) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/misc/get_browser_error.phpt b/ext/standard/tests/misc/get_browser_error.phpt index 049c8b9431..cf15e3c5ef 100644 --- a/ext/standard/tests/misc/get_browser_error.phpt +++ b/ext/standard/tests/misc/get_browser_error.phpt @@ -30,9 +30,6 @@ echo "*** Testing get_browser() : error functionality ***\n"; /* Unknown browser uses defaults. */ var_dump( get_browser( 'foobar', true ) ); -/* More than expected arguments */ -var_dump( get_browser( 'foobar', true, 15 ) ); - /* Some wrong parameters, no HTTP_USER_AGENT set */ var_dump( get_browser( null, 'foobar' ) ); @@ -111,9 +108,6 @@ array(34) { string(1) "0" } -Warning: get_browser() expects at most 2 parameters, 3 given in %s on line %d -NULL - Warning: get_browser(): HTTP_USER_AGENT variable is not set, cannot determine user agent name in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/network/fsockopen_error.phpt b/ext/standard/tests/network/fsockopen_error.phpt index 638412b47f..ea08335f2d 100644 --- a/ext/standard/tests/network/fsockopen_error.phpt +++ b/ext/standard/tests/network/fsockopen_error.phpt @@ -11,21 +11,6 @@ Test fsockopen() function : error conditions echo "*** Testing fsockopen() : basic error conditions ***\n"; - -echo "\n-- Testing fsockopen() function with more than expected no. of arguments --\n"; -$hostname = 'string_val'; -$port = 10; -$errno = 10; -$errstr = 'string_val'; -$timeout = 10.5; -$extra_arg = 10; -var_dump( fsockopen($hostname, $port, $errno, $errstr, $timeout, $extra_arg) ); -var_dump($errstr); -var_dump($errno); - -echo "\n-- Testing fsockopen() function with less than expected no. of arguments --\n"; -var_dump( fsockopen() ); - echo "\n-- Attempting to connect to a non-existent socket --\n"; $hostname = 'tcp://127.0.0.1'; // loopback address $port = 31337; @@ -49,18 +34,6 @@ echo "Done"; --EXPECTF-- *** Testing fsockopen() : basic error conditions *** --- Testing fsockopen() function with more than expected no. of arguments -- - -Warning: fsockopen() expects at most 5 parameters, 6 given in %s on line %d -bool(false) -string(10) "string_val" -int(10) - --- Testing fsockopen() function with less than expected no. of arguments -- - -Warning: fsockopen() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -- Attempting to connect to a non-existent socket -- Warning: fsockopen(): unable to connect to tcp://127.0.0.1:31337 (%a) in %s on line %d diff --git a/ext/standard/tests/network/gethostbyaddr_error.phpt b/ext/standard/tests/network/gethostbyaddr_error.phpt index f7982d5ca4..a33a71185f 100644 --- a/ext/standard/tests/network/gethostbyaddr_error.phpt +++ b/ext/standard/tests/network/gethostbyaddr_error.phpt @@ -11,16 +11,6 @@ Test gethostbyaddr() function : error conditions echo "Testing gethostbyaddr : error conditions\n"; -// Zero arguments -echo "\n-- Testing gethostbyaddr function with Zero arguments --\n"; -var_dump( gethostbyaddr() ); - -//Test gethostbyaddr with one more than the expected number of arguments -echo "\n-- Testing gethostbyaddr function with more than expected no. of arguments --\n"; -$ip_address = 'string_val'; -$extra_arg = 10; -var_dump( gethostbyaddr($ip_address, $extra_arg) ); - echo "\n-- Testing gethostbyaddr function with invalid addresses --\n"; $ip_address = 'invalid'; @@ -37,16 +27,6 @@ echo "Done"; --EXPECTREGEX-- Testing gethostbyaddr : error conditions --- Testing gethostbyaddr function with Zero arguments -- - -Warning: gethostbyaddr\(\) expects exactly 1 parameter, 0 given in .* on line \d+ -NULL - --- Testing gethostbyaddr function with more than expected no. of arguments -- - -Warning: gethostbyaddr\(\) expects exactly 1 parameter, 2 given in .* on line \d+ -NULL - -- Testing gethostbyaddr function with invalid addresses -- Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+ diff --git a/ext/standard/tests/network/gethostname.phpt b/ext/standard/tests/network/gethostname.phpt index e7caaf48eb..57f4c498d0 100644 --- a/ext/standard/tests/network/gethostname.phpt +++ b/ext/standard/tests/network/gethostname.phpt @@ -5,10 +5,6 @@ marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao p --FILE-- <?php var_dump(gethostname()); -var_dump(gethostname("php-zend-brazil")); ?> --EXPECTF-- -%s - -Warning: gethostname() expects exactly %d parameters, %d given in %s on line %d -NULL +string(%d) "%s" diff --git a/ext/standard/tests/network/getprotobyname_error.phpt b/ext/standard/tests/network/getprotobyname_error.phpt index 7ee366ac7a..52ef3b8ee0 100644 --- a/ext/standard/tests/network/getprotobyname_error.phpt +++ b/ext/standard/tests/network/getprotobyname_error.phpt @@ -4,13 +4,8 @@ getprotobyname function errors test edgarsandi - <edgar.r.sandi@gmail.com> --FILE-- <?php - // empty protocol name - var_dump(getprotobyname()); - - // invalid protocol name - var_dump(getprotobyname('abc')); +// invalid protocol name +var_dump(getprotobyname('abc')); ?> ---EXPECTF-- -Warning: getprotobyname() expects exactly 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- bool(false) diff --git a/ext/standard/tests/network/getprotobynumber_error.phpt b/ext/standard/tests/network/getprotobynumber_error.phpt index 7df12e864a..dda2661b5a 100644 --- a/ext/standard/tests/network/getprotobynumber_error.phpt +++ b/ext/standard/tests/network/getprotobynumber_error.phpt @@ -4,13 +4,8 @@ getprotobynumber function errors test edgarsandi - <edgar.r.sandi@gmail.com> --FILE-- <?php - // empty protocol number - var_dump(getprotobynumber()); - - // invalid protocol number - var_dump(getprotobynumber(999)); +// invalid protocol number +var_dump(getprotobynumber(999)); ?> ---EXPECTF-- -Warning: getprotobynumber() expects exactly 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- bool(false) diff --git a/ext/standard/tests/network/inet.phpt b/ext/standard/tests/network/inet.phpt index a1e70a0020..81db0016b5 100644 --- a/ext/standard/tests/network/inet.phpt +++ b/ext/standard/tests/network/inet.phpt @@ -14,12 +14,10 @@ var_dump(inet_ntop($packed)); $packed = chr(255) . chr(255) . chr(255) . chr(0); var_dump(inet_ntop($packed)); -var_dump(inet_ntop()); var_dump(inet_ntop(-1)); var_dump(inet_ntop("")); var_dump(inet_ntop("blah-blah")); -var_dump(inet_pton()); var_dump(inet_pton("")); var_dump(inet_pton(-1)); var_dump(inet_pton("abra")); @@ -40,15 +38,9 @@ echo "Done\n"; --EXPECTF-- string(9) "127.0.0.1" string(13) "255.255.255.0" - -Warning: inet_ntop() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) bool(false) bool(false) bool(false) - -Warning: inet_pton() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) bool(false) bool(false) bool(false) diff --git a/ext/standard/tests/network/ip.phpt b/ext/standard/tests/network/ip.phpt index 5237c89776..831eee018a 100644 --- a/ext/standard/tests/network/ip.phpt +++ b/ext/standard/tests/network/ip.phpt @@ -21,16 +21,11 @@ foreach ($array as $ip) { var_dump(long2ip($long)); } -var_dump(ip2long()); var_dump(ip2long("")); var_dump(ip2long("777.777.777.777")); var_dump(ip2long("111.111.111.111")); -var_dump(ip2long(array())); -var_dump(long2ip()); var_dump(long2ip(-110000)); -var_dump(long2ip("")); -var_dump(long2ip(array())); echo "Done\n"; ?> @@ -47,23 +42,8 @@ int(0) string(7) "0.0.0.0" int(1118019956) string(14) "66.163.161.116" - -Warning: ip2long() expects exactly 1 parameter, 0 given in %sip.php on line %d -NULL bool(false) bool(false) int(1869573999) - -Warning: ip2long() expects parameter 1 to be string, array given in %sip.php on line %d -NULL - -Warning: long2ip() expects exactly 1 parameter, 0 given in %sip.php on line %d -NULL string(13) "255.254.82.80" - -Warning: long2ip() expects parameter 1 to be int, string given in %sip.php on line %d -NULL - -Warning: long2ip() expects parameter 1 to be int, array given in %sip.php on line %d -NULL Done diff --git a/ext/standard/tests/network/ip_x86_64.phpt b/ext/standard/tests/network/ip_x86_64.phpt index 3c530b8371..06ed1549a6 100644 --- a/ext/standard/tests/network/ip_x86_64.phpt +++ b/ext/standard/tests/network/ip_x86_64.phpt @@ -21,16 +21,11 @@ foreach ($array as $ip) { var_dump(long2ip($long)); } -var_dump(ip2long()); var_dump(ip2long("")); var_dump(ip2long("777.777.777.777")); var_dump(ip2long("111.111.111.111")); -var_dump(ip2long(array())); -var_dump(long2ip()); var_dump(long2ip(-110000)); -var_dump(long2ip("")); -var_dump(long2ip(array())); echo "Done\n"; ?> @@ -47,23 +42,8 @@ int(0) string(7) "0.0.0.0" int(1118019956) string(14) "66.163.161.116" - -Warning: ip2long() expects exactly 1 parameter, 0 given in %sip_x86_64.php on line %d -NULL bool(false) bool(false) int(1869573999) - -Warning: ip2long() expects parameter 1 to be string, array given in %sip_x86_64.php on line %d -NULL - -Warning: long2ip() expects exactly 1 parameter, 0 given in %sip_x86_64.php on line %d -NULL string(13) "255.254.82.80" - -Warning: long2ip() expects parameter 1 to be int, string given in %sip_x86_64.php on line %d -NULL - -Warning: long2ip() expects parameter 1 to be int, array given in %sip_x86_64.php on line %d -NULL Done diff --git a/ext/standard/tests/password/password_hash_error.phpt b/ext/standard/tests/password/password_hash_error.phpt index 89ca127bc4..04a8249ced 100644 --- a/ext/standard/tests/password/password_hash_error.phpt +++ b/ext/standard/tests/password/password_hash_error.phpt @@ -4,25 +4,31 @@ Test error operation of password_hash() <?php //-=-=-=- -var_dump(password_hash()); - -var_dump(password_hash("foo")); +try { + var_dump(password_hash("foo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(password_hash("foo", array())); var_dump(password_hash("foo", 19, new StdClass)); -var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz")); +try { + var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -var_dump(password_hash(array(), PASSWORD_BCRYPT)); +try { + var_dump(password_hash(array(), PASSWORD_BCRYPT)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- -Warning: password_hash() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: password_hash() expects at least 2 parameters, 1 given in %s on line %d -NULL +password_hash() expects at least 2 parameters, 1 given Notice: Array to string conversion in %s on line %d @@ -31,9 +37,5 @@ NULL Warning: password_hash(): Unknown password hashing algorithm: 19 in %s on line %d NULL - -Warning: password_hash() expects parameter 3 to be array, string given in %s on line %d -NULL - -Warning: password_hash() expects parameter 1 to be string, array given in %s on line %d -NULL +password_hash() expects parameter 3 to be array, string given +password_hash() expects parameter 1 to be string, array given diff --git a/ext/standard/tests/password/password_needs_rehash_error.phpt b/ext/standard/tests/password/password_needs_rehash_error.phpt index 7180d11de7..f64723ee85 100644 --- a/ext/standard/tests/password/password_needs_rehash_error.phpt +++ b/ext/standard/tests/password/password_needs_rehash_error.phpt @@ -3,29 +3,32 @@ Test error operation of password_needs_rehash() --FILE-- <?php //-=-=-=- -var_dump(password_needs_rehash()); -var_dump(password_needs_rehash('')); +try { + var_dump(password_needs_rehash('')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(password_needs_rehash('', [])); -var_dump(password_needs_rehash(array(), PASSWORD_BCRYPT)); +try { + var_dump(password_needs_rehash(array(), PASSWORD_BCRYPT)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -var_dump(password_needs_rehash("", PASSWORD_BCRYPT, "foo")); +try { + var_dump(password_needs_rehash("", PASSWORD_BCRYPT, "foo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "OK!"; ?> --EXPECTF-- -Warning: password_needs_rehash() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: password_needs_rehash() expects at least 2 parameters, 1 given in %s on line %d -NULL +password_needs_rehash() expects at least 2 parameters, 1 given bool(false) - -Warning: password_needs_rehash() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: password_needs_rehash() expects parameter 3 to be array, string given in %s on line %d -NULL +password_needs_rehash() expects parameter 1 to be string, array given +password_needs_rehash() expects parameter 3 to be array, string given OK! diff --git a/ext/standard/tests/password/password_verify_error.phpt b/ext/standard/tests/password/password_verify_error.phpt index 7f680af448..192a4ae288 100644 --- a/ext/standard/tests/password/password_verify_error.phpt +++ b/ext/standard/tests/password/password_verify_error.phpt @@ -4,14 +4,12 @@ Test error operation of password_verify() <?php //-=-=-=- -var_dump(password_verify()); - -var_dump(password_verify("foo")); +try { + var_dump(password_verify("foo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: password_verify() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: password_verify() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) +--EXPECT-- +password_verify() expects exactly 2 parameters, 1 given diff --git a/ext/standard/tests/streams/bug46426.phpt b/ext/standard/tests/streams/bug46426.phpt index 8c95ea456e..b69c6c557b 100644 --- a/ext/standard/tests/streams/bug46426.phpt +++ b/ext/standard/tests/streams/bug46426.phpt @@ -21,8 +21,6 @@ echo stream_get_contents($tmp, 1, 0); echo "\n"; echo stream_get_contents($tmp, -1); -@unlink($tmp); - ?> --EXPECT-- 23 diff --git a/ext/standard/tests/streams/stream_get_contents_001.phpt b/ext/standard/tests/streams/stream_get_contents_001.phpt index dc7fcb239c..6f5abcb782 100644 --- a/ext/standard/tests/streams/stream_get_contents_001.phpt +++ b/ext/standard/tests/streams/stream_get_contents_001.phpt @@ -12,8 +12,6 @@ echo stream_get_contents($tmp, 2), "--\n"; echo stream_get_contents($tmp, 2, 3), "--\n"; echo stream_get_contents($tmp, 2, -1), "--\n"; -@unlink($tmp); - ?> --EXPECT-- -- diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt index bb98d7c6e7..5530322fec 100644 --- a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt +++ b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt @@ -10,21 +10,6 @@ Test stream_get_meta_data() function : error conditions echo "*** Testing stream_get_meta_data() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing stream_get_meta_data() function with Zero arguments --\n"; -var_dump( stream_get_meta_data() ); - -//Test stream_get_meta_data with one more than the expected number of arguments -echo "\n-- Testing stream_get_meta_data() function with more than expected no. of arguments --\n"; - -$fp = null; -$extra_arg = 10; -var_dump( stream_get_meta_data($fp, $extra_arg) ); - -echo "\n-- Testing stream_get_meta_data() function with invalid stream resource --\n"; -$fp = null; -var_dump(stream_get_meta_data($fp)); - echo "\n-- Testing stream_get_meta_data() function with closed stream resource --\n"; $fp = fopen(__FILE__, 'r'); fclose($fp); @@ -35,21 +20,6 @@ echo "Done"; --EXPECTF-- *** Testing stream_get_meta_data() : error conditions *** --- Testing stream_get_meta_data() function with Zero arguments -- - -Warning: stream_get_meta_data() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing stream_get_meta_data() function with more than expected no. of arguments -- - -Warning: stream_get_meta_data() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Testing stream_get_meta_data() function with invalid stream resource -- - -Warning: stream_get_meta_data() expects parameter 1 to be resource, null given in %s on line %d -NULL - -- Testing stream_get_meta_data() function with closed stream resource -- Warning: stream_get_meta_data(): supplied resource is not a valid stream resource in %s on line %d diff --git a/ext/standard/tests/streams/stream_resolve_include_path.phpt b/ext/standard/tests/streams/stream_resolve_include_path.phpt index 4109b5672e..f77c0730f3 100644 --- a/ext/standard/tests/streams/stream_resolve_include_path.phpt +++ b/ext/standard/tests/streams/stream_resolve_include_path.phpt @@ -14,8 +14,6 @@ mkdir($include_path_nested); file_put_contents($include_path_file, 'include_path'); file_put_contents($include_path_nested_file, 'include_path'); -var_dump(stream_resolve_include_path()); - set_include_path($include_path . PATH_SEPARATOR . $include_path_nested); var_dump(stream_resolve_include_path('file-does-not-exist')); @@ -24,13 +22,20 @@ var_dump(stream_resolve_include_path('file')); set_include_path($include_path_nested . PATH_SEPARATOR . $include_path); var_dump(stream_resolve_include_path('file')); +?> +--CLEAN-- +<?php +$include_path = __DIR__ . '/test_path'; +$include_path_nested = $include_path . '/nested'; +$include_path_file = $include_path . DIRECTORY_SEPARATOR . 'file'; +$include_path_nested_file = $include_path_nested . DIRECTORY_SEPARATOR . 'file'; + unlink($include_path_nested_file); rmdir($include_path_nested); unlink($include_path_file); rmdir($include_path); +?> --EXPECTF-- -Warning: stream_resolve_include_path() expects exactly 1 parameter, 0 given in %s on line %d -NULL bool(false) string(%d) "%stest_path%sfile" string(%d) "%stest_path%snested%sfile" diff --git a/ext/standard/tests/streams/stream_set_chunk_size.phpt b/ext/standard/tests/streams/stream_set_chunk_size.phpt index 8c2ae9865b..851fd2cfcf 100644 --- a/ext/standard/tests/streams/stream_set_chunk_size.phpt +++ b/ext/standard/tests/streams/stream_set_chunk_size.phpt @@ -51,7 +51,6 @@ var_dump(strlen(fwrite($f, str_repeat('b', 250)))); echo "\nerror conditions\n"; var_dump(stream_set_chunk_size($f, 0)); var_dump(stream_set_chunk_size($f, -1)); -var_dump(stream_set_chunk_size($f, array())); --EXPECTF-- bool(true) should return previous chunk size (8192) @@ -87,6 +86,3 @@ bool(false) Warning: stream_set_chunk_size(): The chunk size must be a positive integer, given -1 in %s on line %d bool(false) - -Warning: stream_set_chunk_size() expects parameter 2 to be int, array given in %s on line %d -bool(false) diff --git a/ext/standard/tests/streams/stream_set_timeout_error.phpt b/ext/standard/tests/streams/stream_set_timeout_error.phpt index 0334b951e0..6c5b992dd5 100644 --- a/ext/standard/tests/streams/stream_set_timeout_error.phpt +++ b/ext/standard/tests/streams/stream_set_timeout_error.phpt @@ -10,9 +10,6 @@ Test stream_set_timeout() function : error conditions echo "*** Testing stream_set_timeout() : error conditions ***\n"; -//Test stream_set_timeout with one more than the expected number of arguments -echo "\n-- Testing stream_set_timeout() function with more than expected no. of arguments --\n"; - for ($i=0; $i<100; $i++) { $port = rand(10000, 65000); /* Setup socket server */ @@ -26,23 +23,11 @@ $client = fsockopen("tcp://127.0.0.1:$port"); $seconds = 10; $microseconds = 10; -$extra_arg = 10; -var_dump( stream_set_timeout($client, $seconds, $microseconds, $extra_arg) ); - -// Testing stream_set_timeout with one less than the expected number of arguments -echo "\n-- Testing stream_set_timeout() function with less than expected no. of arguments --\n"; - -$seconds = 10; -var_dump( stream_set_timeout($client) ); - echo "\n-- Testing stream_set_timeout() function with a closed socket --\n"; fclose($client); var_dump( stream_set_timeout($client, $seconds) ); -echo "\n-- Testing stream_set_timeout() function with an invalid stream --\n"; -var_dump( stream_set_timeout($seconds, $seconds) ); - echo "\n-- Testing stream_set_timeout() function with a stream that does not support timeouts --\n"; $filestream = fopen(__FILE__, "r"); var_dump( stream_set_timeout($filestream, $seconds) ); @@ -55,26 +40,11 @@ echo "Done"; --EXPECTF-- *** Testing stream_set_timeout() : error conditions *** --- Testing stream_set_timeout() function with more than expected no. of arguments -- - -Warning: stream_set_timeout() expects at most 3 parameters, 4 given in %s on line %d -NULL - --- Testing stream_set_timeout() function with less than expected no. of arguments -- - -Warning: stream_set_timeout() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing stream_set_timeout() function with a closed socket -- Warning: stream_set_timeout(): supplied resource is not a valid stream resource in %s on line %d bool(false) --- Testing stream_set_timeout() function with an invalid stream -- - -Warning: stream_set_timeout() expects parameter 1 to be resource, int given in %s on line %d -NULL - -- Testing stream_set_timeout() function with a stream that does not support timeouts -- bool(false) Done diff --git a/ext/standard/tests/streams/stream_socket_sendto.phpt b/ext/standard/tests/streams/stream_socket_sendto.phpt index 2812d30930..ab223f4314 100644 --- a/ext/standard/tests/streams/stream_socket_sendto.phpt +++ b/ext/standard/tests/streams/stream_socket_sendto.phpt @@ -16,8 +16,6 @@ $sock = stream_socket_server($serverUri, $errno, $errstr); if (is_resource($sock)) { fwrite($sock, $stringFWrite); - var_dump(stream_socket_sendto()); - var_dump(stream_socket_sendto($sock)); var_dump(stream_socket_sendto($sock, $stringSocket)); var_dump(stream_socket_sendto($sock, $stringSocket, STREAM_OOB)); var_dump(stream_socket_sendto($sock, $stringSocket, STREAM_OOB, $serverUri)); @@ -29,12 +27,6 @@ if (is_resource($sock)) { --EXPECTF-- Notice: fwrite(): send of %i bytes failed with errno=%i Broken pipe in %s on line %d -Warning: stream_socket_sendto() expects at least %i parameters, %i given in %s on line %d -bool(%s) - -Warning: stream_socket_sendto() expects at least %i parameters, %i given in %s on line %d -bool(%s) - Warning: stream_socket_sendto(): Broken pipe in %s on line %d int(%i) diff --git a/ext/standard/tests/strings/addcslashes_001.phpt b/ext/standard/tests/strings/addcslashes_001.phpt Binary files differindex 4080c7214d..5b60f6168d 100644 --- a/ext/standard/tests/strings/addcslashes_001.phpt +++ b/ext/standard/tests/strings/addcslashes_001.phpt diff --git a/ext/standard/tests/strings/bug54322.phpt b/ext/standard/tests/strings/bug54322.phpt index 6b8d10daa7..f31f94fd84 100644 --- a/ext/standard/tests/strings/bug54322.phpt +++ b/ext/standard/tests/strings/bug54322.phpt @@ -2,9 +2,11 @@ Bug #54322: Null pointer deref in get_html_translation_table due to information loss in long-to-int conversion --FILE-- <?php -var_dump( -get_html_translation_table(NAN, 0, "UTF-8") > 0 -); ---EXPECTF-- -Warning: get_html_translation_table() expects parameter 1 to be int, float given in %s on line %d -bool(false) +try { + var_dump(get_html_translation_table(NAN, 0, "UTF-8") > 0); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECT-- +get_html_translation_table() expects parameter 1 to be int, float given diff --git a/ext/standard/tests/strings/chr_error.phpt b/ext/standard/tests/strings/chr_error.phpt index d5fb974559..7f089ac5b5 100644 --- a/ext/standard/tests/strings/chr_error.phpt +++ b/ext/standard/tests/strings/chr_error.phpt @@ -11,11 +11,19 @@ Test chr() function : error conditions echo "*** Testing chr() : error conditions ***\n"; echo "\n-- Testing chr() function with no arguments --\n"; -var_dump( chr() ); +try { + var_dump( chr() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing chr() function with more than expected no. of arguments --\n"; $extra_arg = 10; -var_dump( chr(72, $extra_arg) ); +try { + var_dump( chr(72, $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== @@ -23,12 +31,8 @@ var_dump( chr(72, $extra_arg) ); *** Testing chr() : error conditions *** -- Testing chr() function with no arguments -- - -Warning: Wrong parameter count for chr() in %s on line %d -NULL +Wrong parameter count for chr() -- Testing chr() function with more than expected no. of arguments -- - -Warning: Wrong parameter count for chr() in %s on line %d -NULL +Wrong parameter count for chr() ===DONE=== diff --git a/ext/standard/tests/strings/chr_ord.phpt b/ext/standard/tests/strings/chr_ord.phpt Binary files differindex be0b1a32da..43e31a20f3 100644 --- a/ext/standard/tests/strings/chr_ord.phpt +++ b/ext/standard/tests/strings/chr_ord.phpt diff --git a/ext/standard/tests/strings/chunk_split_variation5.phpt b/ext/standard/tests/strings/chunk_split_variation5.phpt Binary files differindex 8a5a8cd6bb..8650f2cb92 100644 --- a/ext/standard/tests/strings/chunk_split_variation5.phpt +++ b/ext/standard/tests/strings/chunk_split_variation5.phpt diff --git a/ext/standard/tests/strings/chunk_split_variation8.phpt b/ext/standard/tests/strings/chunk_split_variation8.phpt index bfafd1af0b..9804ee21e1 100644 --- a/ext/standard/tests/strings/chunk_split_variation8.phpt +++ b/ext/standard/tests/strings/chunk_split_variation8.phpt @@ -46,7 +46,11 @@ $values = array ( // loop through each element of values for 'chunklen' for($count = 0; $count < count($values); $count++) { echo "-- Iteration ".($count+1). " --\n"; - var_dump( chunk_split($heredoc_str, $values[$count], $ending) ); + try { + var_dump( chunk_split($heredoc_str, $values[$count], $ending) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } echo "Done" @@ -82,9 +86,7 @@ string(129) "This's heredoc string with and It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test chunk_split():::" -- Iteration 7 -- - -Warning: chunk_split() expects parameter 2 to be int, float given in %s on line %d -NULL +chunk_split() expects parameter 2 to be int, float given -- Iteration 8 -- Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d diff --git a/ext/standard/tests/strings/convert_cyr_string.phpt b/ext/standard/tests/strings/convert_cyr_string.phpt index af239543c5..a1473ad316 100644 --- a/ext/standard/tests/strings/convert_cyr_string.phpt +++ b/ext/standard/tests/strings/convert_cyr_string.phpt @@ -3,11 +3,7 @@ basic convert_cyr_string() tests --FILE-- <?php -var_dump(convert_cyr_string()); -var_dump(convert_cyr_string("")); -var_dump(convert_cyr_string("", "")); var_dump(convert_cyr_string("", "", "")); -var_dump(convert_cyr_string(array(), array(), array())); var_dump(convert_cyr_string("[[[[[[", "q", "m")); var_dump(convert_cyr_string("[[[[[[", "k", "w")); @@ -20,23 +16,11 @@ var_dump(convert_cyr_string("", "d", "i")); echo "Done\n"; ?> --EXPECTF-- -Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: convert_cyr_string() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d -NULL - Warning: convert_cyr_string(): Unknown source charset: in %s on line %d Warning: convert_cyr_string(): Unknown destination charset: in %s on line %d string(0) "" -Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d -NULL - Warning: convert_cyr_string(): Unknown source charset: q in %s on line %d string(6) "[[[[[[" string(6) "[[[[[[" diff --git a/ext/standard/tests/strings/convert_cyr_string_error.phpt b/ext/standard/tests/strings/convert_cyr_string_error.phpt index 66effea430..6ac438efaf 100644 --- a/ext/standard/tests/strings/convert_cyr_string_error.phpt +++ b/ext/standard/tests/strings/convert_cyr_string_error.phpt @@ -15,15 +15,6 @@ $extra_arg = 10; echo "*** Testing convert_cyr_string() : error conditions ***\n"; -echo "\n-- Testing convert_cyr_string() function with no arguments --\n"; -var_dump( convert_cyr_string() ); - -echo "\n-- Testing convert_cyr_string() function with no 'to' character set --\n"; -var_dump( convert_cyr_string($str, $from) ); - -echo "\n-- Testing convert_cyr_string() function with more than expected no. of arguments --\n"; -var_dump( convert_cyr_string($str, $from, $to, $extra_arg) ); - echo "\n-- Testing convert_cyr_string() function with invalid 'from' character set --\n"; var_dump(bin2hex( convert_cyr_string($str, "?", $to) )); @@ -38,21 +29,6 @@ var_dump(bin2hex( convert_cyr_string($str, ">", "?")) ); --EXPECTF-- *** Testing convert_cyr_string() : error conditions *** --- Testing convert_cyr_string() function with no arguments -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d -NULL - --- Testing convert_cyr_string() function with no 'to' character set -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d -NULL - --- Testing convert_cyr_string() function with more than expected no. of arguments -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 4 given in %s on line %d -NULL - -- Testing convert_cyr_string() function with invalid 'from' character set -- Warning: convert_cyr_string(): Unknown source charset: ? in %s on line %d diff --git a/ext/standard/tests/strings/crypt.phpt b/ext/standard/tests/strings/crypt.phpt index f64b61cb5f..270f0372d1 100644 --- a/ext/standard/tests/strings/crypt.phpt +++ b/ext/standard/tests/strings/crypt.phpt @@ -19,8 +19,6 @@ echo (CRYPT_MD5) ? ((crypt($str, $salt3) === $res_3) ? 'MD5' : 'MD5 - ERROR echo (CRYPT_BLOWFISH) ? ((crypt($str, $salt4) === $res_4) ? 'BLO' : 'BLO - ERROR') : 'BLO', "\n"; var_dump(crypt($str)); -var_dump(crypt()); -var_dump(crypt("", "", "")); ?> --EXPECTF-- @@ -31,9 +29,3 @@ BLO Notice: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash. in %s on line %d string(%d) "%s" - -Warning: crypt() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: crypt() expects at most 2 parameters, 3 given in %s on line %d -NULL diff --git a/ext/standard/tests/strings/dirname_error.phpt b/ext/standard/tests/strings/dirname_error.phpt index 98a9ea5b45..79fac30029 100644 --- a/ext/standard/tests/strings/dirname_error.phpt +++ b/ext/standard/tests/strings/dirname_error.phpt @@ -6,26 +6,15 @@ Test dirname() function : error conditions Description: Returns directory name component of path. */ echo "*** Testing error conditions ***\n"; -// zero arguments -var_dump( dirname() ); // Bad arg var_dump( dirname("/var/tmp/bar.gz", 0) ); -// more than expected no. of arguments -var_dump( dirname("/var/tmp/bar.gz", 1, ".gz") ); - echo "Done\n"; ?> --EXPECTF-- *** Testing error conditions *** -Warning: dirname() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: dirname(): Invalid argument, levels must be >= 1 in %s on line %d NULL - -Warning: dirname() expects at most 2 parameters, 3 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/strings/explode1.phpt b/ext/standard/tests/strings/explode1.phpt index 6842947605..de3049a47b 100644 --- a/ext/standard/tests/strings/explode1.phpt +++ b/ext/standard/tests/strings/explode1.phpt @@ -77,11 +77,6 @@ class string1 { $obj = new string1; var_dump( explode("b", $obj) ); -echo "\n*** Testing error conditions ***\n"; -/* checking for arguments <2 and >3 */ -var_dump( explode(":", "array1:array2:array3", -1, -33) ); -var_dump( explode(":") ); - echo "Done\n"; ?> --EXPECTF-- @@ -498,12 +493,4 @@ array(2) { [1]=> string(4) "ject" } - -*** Testing error conditions *** - -Warning: explode() expects at most 3 parameters, 4 given in %s on line %d -NULL - -Warning: explode() expects at least 2 parameters, 1 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/strings/fprintf_error.phpt b/ext/standard/tests/strings/fprintf_error.phpt index ccc37407e8..1ffc188051 100644 --- a/ext/standard/tests/strings/fprintf_error.phpt +++ b/ext/standard/tests/strings/fprintf_error.phpt @@ -7,25 +7,31 @@ Test fprintf() function (errors) echo "*** Testing Error Conditions ***\n"; /* zero argument */ -var_dump( fprintf() ); +try { + var_dump( fprintf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* scalar argument */ -var_dump( fprintf(3) ); +try { + var_dump( fprintf(3) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* NULL argument */ -var_dump( fprintf(NULL) ); +try { + var_dump( fprintf(NULL) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> --EXPECTF-- *** Testing Error Conditions *** - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL +Wrong parameter count for fprintf() +Wrong parameter count for fprintf() +Wrong parameter count for fprintf() Done diff --git a/ext/standard/tests/strings/highlight_file.phpt b/ext/standard/tests/strings/highlight_file.phpt index 65636908e6..10ea752291 100644 --- a/ext/standard/tests/strings/highlight_file.phpt +++ b/ext/standard/tests/strings/highlight_file.phpt @@ -13,7 +13,6 @@ allow_url_fopen=1 $filename = dirname(__FILE__)."/highlight_file.dat"; -var_dump(highlight_file()); var_dump(highlight_file($filename)); var_dump(highlight_file('data:,<?php echo "test"; ?>')); @@ -37,9 +36,6 @@ var_dump(highlight_file($filename)); echo "Done\n"; ?> --EXPECTF-- -Warning: highlight_file() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - Warning: highlight_file(%shighlight_file.dat): failed to open stream: No such file or directory in %s on line %d Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d diff --git a/ext/standard/tests/strings/htmlentities24.phpt b/ext/standard/tests/strings/htmlentities24.phpt index 5a023df701..f2abfd5ba8 100644 --- a/ext/standard/tests/strings/htmlentities24.phpt +++ b/ext/standard/tests/strings/htmlentities24.phpt @@ -35,12 +35,6 @@ var_dump( htmlentities($str, ENT_QUOTES) ); var_dump( htmlentities($str, ENT_NOQUOTES) ); var_dump( htmlentities($str, ENT_COMPAT) ); -echo "\n*** Testing error conditions ***\n"; -/* zero argument */ -var_dump( htmlentities() ); -/* arguments more than expected */ -var_dump( htmlentities("\x84\x91",ENT_QUOTES, 'cp1252', "test1") ); - echo "Done\n"; ?> --EXPECTF-- @@ -320,10 +314,4 @@ string(36) "A 'quote' is <b>bold</b>" string(46) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" - -*** Testing error conditions *** - -Warning: htmlentities() expects at least 1 parameter, 0 given in %s on line %d -NULL -string(14) "„‘" Done diff --git a/ext/standard/tests/strings/htmlspecialchars.phpt b/ext/standard/tests/strings/htmlspecialchars.phpt index 8506c73e72..6e5c5fac36 100644 --- a/ext/standard/tests/strings/htmlspecialchars.phpt +++ b/ext/standard/tests/strings/htmlspecialchars.phpt @@ -35,13 +35,6 @@ var_dump( htmlspecialchars($str, ENT_QUOTES) ); var_dump( htmlspecialchars($str, ENT_NOQUOTES) ); var_dump( htmlspecialchars($str, ENT_COMPAT) ); -echo "\n*** Testing error conditions ***\n"; -/* zero argument */ -var_dump( htmlspecialchars() ); - -/* giving arguments more than expected */ -var_dump( htmlspecialchars("<br>",ENT_QUOTES,'iso-8859-1', "test2") ); - echo "Done\n" ?> --EXPECTF-- @@ -321,10 +314,4 @@ string(36) "A 'quote' is <b>bold</b>" string(46) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" - -*** Testing error conditions *** - -Warning: htmlspecialchars() expects at least 1 parameter, 0 given in %s on line %d -NULL -string(10) "<br>" Done diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt Binary files differindex d5de391e96..9d9afc6f3c 100644 --- a/ext/standard/tests/strings/implode1.phpt +++ b/ext/standard/tests/strings/implode1.phpt diff --git a/ext/standard/tests/strings/join_error.phpt b/ext/standard/tests/strings/join_error.phpt index 36ee9d7ba6..832fb58c05 100644 --- a/ext/standard/tests/strings/join_error.phpt +++ b/ext/standard/tests/strings/join_error.phpt @@ -10,18 +10,6 @@ Test join() function: error conditions echo "*** Testing join() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing join() function with Zero arguments --\n"; -var_dump( join() ); - -// More than expected number of arguments -echo "\n-- Testing join() function with more than expected no. of arguments --\n"; -$glue = 'string_val'; -$pieces = array(1, 2); -$extra_arg = 10; - -var_dump( join($glue, $pieces, $extra_arg) ); - // Less than expected number of arguments echo "\n-- Testing join() with less than expected no. of arguments --\n"; $glue = 'string_val'; @@ -33,16 +21,6 @@ echo "Done\n"; --EXPECTF-- *** Testing join() : error conditions *** --- Testing join() function with Zero arguments -- - -Warning: join() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing join() function with more than expected no. of arguments -- - -Warning: join() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Testing join() with less than expected no. of arguments -- Warning: join(): Argument must be an array in %s on line %d diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt Binary files differindex 97dfc4153b..38cb7e566f 100644 --- a/ext/standard/tests/strings/lcfirst.phpt +++ b/ext/standard/tests/strings/lcfirst.phpt diff --git a/ext/standard/tests/strings/levenshtein.phpt b/ext/standard/tests/strings/levenshtein.phpt index 1ac05cf2ae..b4b7c03e7f 100644 --- a/ext/standard/tests/strings/levenshtein.phpt +++ b/ext/standard/tests/strings/levenshtein.phpt @@ -63,10 +63,8 @@ $n += test_me("gt maxlength2", -1, "A", "AbcdefghijklmnopqrstuvwxyzAbcdefghijkl echo ($n==0)?"all passed\n":"$n failed\n"; -var_dump(levenshtein(array(), array())); var_dump(levenshtein("", "", -1, -1, -1)); var_dump(levenshtein("", "", 10, 10, 10)); -var_dump(levenshtein("")); ?> --EXPECTF-- @@ -76,11 +74,5 @@ Warning: levenshtein(): Argument string(s) too long in %s on line %d Warning: levenshtein(): Argument string(s) too long in %s on line %d all passed - -Warning: levenshtein() expects parameter 1 to be string, array given in %s on line %d -NULL int(0) int(0) - -Warning: Wrong parameter count for levenshtein() in %s on line %d -NULL diff --git a/ext/standard/tests/strings/ltrim.phpt b/ext/standard/tests/strings/ltrim.phpt index 638c93557f..51287e04d7 100644 --- a/ext/standard/tests/strings/ltrim.phpt +++ b/ext/standard/tests/strings/ltrim.phpt @@ -9,12 +9,6 @@ Test ltrim() function echo "\n *** Output for Error Conditions ***\n"; - echo "\n *** Output for zero argument ***\n"; - var_dump( ltrim() ); - - echo "\n *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) ***\n"; - var_dump( ltrim("", " ", 1) ); - /* heredoc string */ $str = <<<EOD us @@ -50,16 +44,6 @@ echo "\nDone\n"; --EXPECTF-- *** Output for Error Conditions *** - *** Output for zero argument *** - -Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - - *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) *** - -Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - *** Using heredoc string *** string(17) "ng heredoc string" diff --git a/ext/standard/tests/strings/ltrim_error.phpt b/ext/standard/tests/strings/ltrim_error.phpt index 694d9fea18..58324d7f3a 100644 --- a/ext/standard/tests/strings/ltrim_error.phpt +++ b/ext/standard/tests/strings/ltrim_error.phpt @@ -11,14 +11,6 @@ Test ltrim() function : error conditions echo "*** Testing ltrim() : error conditions ***\n"; -echo "\n-- Testing ltrim() function with no arguments --\n"; -var_dump( ltrim() ); - -echo "\n-- Testing ltrim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( ltrim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test ltrim function with various invalid charlists\n"; var_dump(ltrim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(ltrim($hello, "a..b..c")); --EXPECTF-- *** Testing ltrim() : error conditions *** --- Testing ltrim() function with no arguments -- - -Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing ltrim() function with more than expected no. of arguments -- - -Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test ltrim function with various invalid charlists Warning: ltrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/md5_file.phpt b/ext/standard/tests/strings/md5_file.phpt Binary files differindex 45009669f4..e56987cd6a 100644 --- a/ext/standard/tests/strings/md5_file.phpt +++ b/ext/standard/tests/strings/md5_file.phpt diff --git a/ext/standard/tests/strings/metaphone.phpt b/ext/standard/tests/strings/metaphone.phpt index ef1d23d89a..c70b4846a1 100644 --- a/ext/standard/tests/strings/metaphone.phpt +++ b/ext/standard/tests/strings/metaphone.phpt @@ -3,7 +3,6 @@ metaphone() tests --FILE-- <?php -var_dump(metaphone()); var_dump(metaphone("")); var_dump(metaphone(-1)); var_dump(metaphone(-1, -1)); @@ -26,8 +25,6 @@ foreach($array as $str) { echo "Done\n"; ?> --EXPECTF-- -Warning: metaphone() expects at least 1 parameter, 0 given in %s on line %d -NULL string(0) "" string(0) "" bool(false) diff --git a/ext/standard/tests/strings/money_format_error.phpt b/ext/standard/tests/strings/money_format_error.phpt index 454b593537..8a4366f1bb 100644 --- a/ext/standard/tests/strings/money_format_error.phpt +++ b/ext/standard/tests/strings/money_format_error.phpt @@ -23,15 +23,6 @@ $extra_arg = 10; echo "*** Testing money_format() : error conditions ***\n"; -echo "\n-- Testing money_format() function with no arguments --\n"; -var_dump( money_format() ); - -echo "\n-- Testing money_format() function with insufficient arguments --\n"; -var_dump( money_format($string) ); - -echo "\n-- Testing money_format() function with more than expected no. of arguments --\n"; -var_dump( money_format($string, $value, $extra_arg) ); - echo "\n-- Testing money_format() function with more than one token --\n"; var_dump( money_format($string . $string, $value) ); ?> @@ -39,21 +30,6 @@ var_dump( money_format($string . $string, $value) ); --EXPECTF-- *** Testing money_format() : error conditions *** --- Testing money_format() function with no arguments -- - -Warning: money_format() expects exactly 2 parameters, 0 given in %s on line %d -NULL - --- Testing money_format() function with insufficient arguments -- - -Warning: money_format() expects exactly 2 parameters, 1 given in %s on line %d -NULL - --- Testing money_format() function with more than expected no. of arguments -- - -Warning: money_format() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -- Testing money_format() function with more than one token -- Warning: money_format(): Only a single %ci or %cn token can be used in %s on line %d diff --git a/ext/standard/tests/strings/pathinfo.phpt b/ext/standard/tests/strings/pathinfo.phpt index a3d735069d..2bbea73588 100644 --- a/ext/standard/tests/strings/pathinfo.phpt +++ b/ext/standard/tests/strings/pathinfo.phpt @@ -3,7 +3,6 @@ pathinfo() tests --FILE-- <?php -var_dump(pathinfo()); var_dump(pathinfo("")); var_dump(pathinfo(".")); var_dump(pathinfo("..")); @@ -27,8 +26,6 @@ var_dump(pathinfo(__FILE__, PATHINFO_DIRNAME|PATHINFO_BASENAME)); echo "Done\n"; ?> --EXPECTF-- -Warning: pathinfo() expects at least 1 parameter, 0 given in %s on line %d -NULL array(2) { ["basename"]=> string(0) "" diff --git a/ext/standard/tests/strings/php_strip_whitespace.phpt b/ext/standard/tests/strings/php_strip_whitespace.phpt index d9376b101a..caab3bc1d2 100644 --- a/ext/standard/tests/strings/php_strip_whitespace.phpt +++ b/ext/standard/tests/strings/php_strip_whitespace.phpt @@ -5,7 +5,6 @@ php_strip_whitespace() tests $filename = dirname(__FILE__)."/php_strip_whitespace.dat"; -var_dump(php_strip_whitespace()); var_dump(php_strip_whitespace($filename)); $data = '/* test comment */'; @@ -40,9 +39,6 @@ var_dump(php_strip_whitespace($filename)); echo "Done\n"; ?> --EXPECTF-- -Warning: php_strip_whitespace() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - Warning: php_strip_whitespace(%sphp_strip_whitespace.dat): failed to open stream: No such file or directory in %s on line %d string(0) "" string(18) "/* test comment */" diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt index eab44a4a65..89b1b9ace2 100644 --- a/ext/standard/tests/strings/printf.phpt +++ b/ext/standard/tests/strings/printf.phpt @@ -28,7 +28,11 @@ $strings = array( NULL, "abc", 'aaa' ); /* Zero argument */ echo "\n*** Output for zero argument ***\n"; -printf(); +try { + printf(); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* Number of arguments not matching as specified in format field */ echo "\n*** Output for insufficient number of arguments ***\n"; @@ -226,8 +230,7 @@ printf("%d", $tempstring); ?> --EXPECTF-- *** Output for zero argument *** - -Warning: printf() expects at least %d parameter, %d given in %s on line %d +printf() expects at least %d parameter, %d given *** Output for insufficient number of arguments *** diff --git a/ext/standard/tests/strings/printf_64bit.phpt b/ext/standard/tests/strings/printf_64bit.phpt index 1a90970371..0106f71445 100644 --- a/ext/standard/tests/strings/printf_64bit.phpt +++ b/ext/standard/tests/strings/printf_64bit.phpt @@ -28,7 +28,11 @@ $strings = array( NULL, "abc", 'aaa' ); /* Zero argument */ echo "\n*** Output for zero argument ***\n"; -printf(); +try { + printf(); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* Number of arguments not matching as specified in format field */ echo "\n*** Output for insufficient number of arguments ***\n"; @@ -226,8 +230,7 @@ printf("%d", $tempstring); ?> --EXPECTF-- *** Output for zero argument *** - -Warning: printf() expects at least 1 parameter, 0 given in %s on line %d +printf() expects at least 1 parameter, 0 given *** Output for insufficient number of arguments *** diff --git a/ext/standard/tests/strings/printf_error.phpt b/ext/standard/tests/strings/printf_error.phpt index a88390bc04..aff95426e6 100644 --- a/ext/standard/tests/strings/printf_error.phpt +++ b/ext/standard/tests/strings/printf_error.phpt @@ -11,7 +11,11 @@ echo "*** Testing printf() : error conditions ***\n"; // Zero arguments echo "\n-- Testing printf() function with Zero arguments --\n"; -var_dump( printf() ); +try { + var_dump( printf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing printf() function with less than expected no. of arguments --\n"; $format1 = '%s'; @@ -38,9 +42,7 @@ var_dump( printf($format3) ); *** Testing printf() : error conditions *** -- Testing printf() function with Zero arguments -- - -Warning: printf() expects at least 1 parameter, 0 given in %s on line %d -bool(false) +printf() expects at least 1 parameter, 0 given -- Testing printf() function with less than expected no. of arguments -- diff --git a/ext/standard/tests/strings/quoted_printable_encode_001.phpt b/ext/standard/tests/strings/quoted_printable_encode_001.phpt index 1ce7d791dc..df26d5cf4b 100644 --- a/ext/standard/tests/strings/quoted_printable_encode_001.phpt +++ b/ext/standard/tests/strings/quoted_printable_encode_001.phpt @@ -3,30 +3,18 @@ quoted_printable_encode() tests - 1 --FILE-- <?php -var_dump(quoted_printable_encode()); var_dump(quoted_printable_encode("")); var_dump(quoted_printable_encode("test")); -var_dump(quoted_printable_encode("test", "more")); -$a = array("str"); -var_dump(quoted_printable_encode($a)); var_dump(quoted_printable_encode(1)); var_dump(quoted_printable_encode(NULL)); var_dump(quoted_printable_encode(false)); echo "Done\n"; ?> ---EXPECTF-- -Warning: quoted_printable_encode() expects exactly 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- string(0) "" string(4) "test" - -Warning: quoted_printable_encode() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: quoted_printable_encode() expects parameter 1 to be string, array given in %s on line %d -NULL string(1) "1" string(0) "" string(0) "" diff --git a/ext/standard/tests/strings/rtrim.phpt b/ext/standard/tests/strings/rtrim.phpt Binary files differindex 5f57b0e850..223a839f58 100644 --- a/ext/standard/tests/strings/rtrim.phpt +++ b/ext/standard/tests/strings/rtrim.phpt diff --git a/ext/standard/tests/strings/rtrim_error.phpt b/ext/standard/tests/strings/rtrim_error.phpt index 108f96a1f0..210fb58c4e 100644 --- a/ext/standard/tests/strings/rtrim_error.phpt +++ b/ext/standard/tests/strings/rtrim_error.phpt @@ -11,14 +11,6 @@ Test rtrim() function : error conditions echo "*** Testing rtrim() : error conditions ***\n"; -echo "\n-- Testing rtrim() function with no arguments --\n"; -var_dump( rtrim() ); - -echo "\n-- Testing rtrim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( rtrim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test rtrim function with various invalid charlists\n"; var_dump(rtrim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(rtrim($hello, "a..b..c")); --EXPECTF-- *** Testing rtrim() : error conditions *** --- Testing rtrim() function with no arguments -- - -Warning: rtrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing rtrim() function with more than expected no. of arguments -- - -Warning: rtrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test rtrim function with various invalid charlists Warning: rtrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/setlocale_error.phpt b/ext/standard/tests/strings/setlocale_error.phpt index 14bb7d7ed5..c2b18b1992 100644 --- a/ext/standard/tests/strings/setlocale_error.phpt +++ b/ext/standard/tests/strings/setlocale_error.phpt @@ -18,14 +18,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { echo "*** Testing setlocale() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing setlocale() function with Zero arguments --"; -var_dump( setlocale()); - -// One argument -echo "\n-- Testing setlocale() function with One argument, 'category' = LC_ALL --"; -var_dump( setlocale(LC_ALL) ); - echo "\n-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --\n"; //Invalid array of locales $invalid_locales = array("en_US.invalid", "en_AU.invalid", "ko_KR.invalid"); @@ -44,14 +36,6 @@ echo "\nDone"; --EXPECTF-- *** Testing setlocale() : error conditions *** --- Testing setlocale() function with Zero arguments -- -Warning: setlocale() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing setlocale() function with One argument, 'category' = LC_ALL -- -Warning: setlocale() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing setlocale() function with invalid locale array, 'category' = LC_ALL -- bool(false) diff --git a/ext/standard/tests/strings/sha1_file.phpt b/ext/standard/tests/strings/sha1_file.phpt index 102dab75ff..09e81be014 100644 --- a/ext/standard/tests/strings/sha1_file.phpt +++ b/ext/standard/tests/strings/sha1_file.phpt @@ -46,12 +46,6 @@ var_dump( sha1_file(12) ); echo "\n-- NULL as filename --\n"; var_dump( sha1_file(NULL) ); -echo "\n-- Zero arguments --\n"; - var_dump ( sha1_file() ); - -echo "\n-- More than valid number of arguments ( valid is 2) --\n"; -var_dump ( sha1_file("EmptyFileSHA1.txt", true, NULL) ); - echo "\n-- Hexadecimal Output for Empty file as Argument --\n"; var_dump( sha1_file("EmptyFileSHA1.txt") ); @@ -95,16 +89,6 @@ bool(false) Warning: sha1_file(): Filename cannot be empty in %s on line %d bool(false) --- Zero arguments -- - -Warning: sha1_file() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- More than valid number of arguments ( valid is 2) -- - -Warning: sha1_file() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Hexadecimal Output for Empty file as Argument -- string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" diff --git a/ext/standard/tests/strings/soundex.phpt b/ext/standard/tests/strings/soundex.phpt index 650236c2e5..744f71c17a 100644 --- a/ext/standard/tests/strings/soundex.phpt +++ b/ext/standard/tests/strings/soundex.phpt @@ -5,7 +5,6 @@ soundex() tests var_dump(soundex("")); var_dump(soundex(-1)); -var_dump(soundex(array())); $array = array( "From", @@ -34,9 +33,6 @@ echo "Done\n"; --EXPECTF-- bool(false) string(4) "0000" - -Warning: soundex() expects parameter 1 to be string, array given in %s on line %d -NULL string(4) "F650" string(4) "T300" string(4) "T500" diff --git a/ext/standard/tests/strings/sprintf_error.phpt b/ext/standard/tests/strings/sprintf_error.phpt index 1c12cd3168..1b21b8b141 100644 --- a/ext/standard/tests/strings/sprintf_error.phpt +++ b/ext/standard/tests/strings/sprintf_error.phpt @@ -11,7 +11,11 @@ echo "*** Testing sprintf() : error conditions ***\n"; // Zero arguments echo "\n-- Testing sprintf() function with Zero arguments --\n"; -var_dump( sprintf() ); +try { + var_dump( sprintf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing sprintf() function with less than expected no. of arguments --\n"; $format1 = '%s'; @@ -38,9 +42,7 @@ echo "Done"; *** Testing sprintf() : error conditions *** -- Testing sprintf() function with Zero arguments -- - -Warning: sprintf() expects at least %d parameter, %d given in %s on line %d -bool(false) +sprintf() expects at least %d parameter, %d given -- Testing sprintf() function with less than expected no. of arguments -- diff --git a/ext/standard/tests/strings/sscanf_error.phpt b/ext/standard/tests/strings/sscanf_error.phpt index ca967758ab..3e54a42f1e 100644 --- a/ext/standard/tests/strings/sscanf_error.phpt +++ b/ext/standard/tests/strings/sscanf_error.phpt @@ -12,12 +12,6 @@ echo "*** Testing sscanf() : error conditions ***\n"; $str = "Hello World"; $format = "%s %s"; -echo "\n-- Testing sscanf() function with no arguments --\n"; -var_dump( sscanf() ); - -echo "\n-- Testing sscanf() function with one argument --\n"; -var_dump( sscanf($str) ); - echo "\n-- Testing sscanf() function with more than expected no. of arguments --\n"; var_dump( sscanf($str, $format, $str1, $str2, $extra_str) ); @@ -27,16 +21,6 @@ var_dump( sscanf($str, $format, $str1, $str2, $extra_str) ); --EXPECTF-- *** Testing sscanf() : error conditions *** --- Testing sscanf() function with no arguments -- - -Warning: sscanf() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing sscanf() function with one argument -- - -Warning: sscanf() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing sscanf() function with more than expected no. of arguments -- Warning: sscanf(): Variable is not assigned by any conversion specifiers in %s on line %d diff --git a/ext/standard/tests/strings/str_ireplace.phpt b/ext/standard/tests/strings/str_ireplace.phpt index 526b8ac723..71a9d1e127 100644 --- a/ext/standard/tests/strings/str_ireplace.phpt +++ b/ext/standard/tests/strings/str_ireplace.phpt @@ -3,9 +3,6 @@ str_ireplace() tests --FILE-- <?php -var_dump(str_ireplace()); -var_dump(str_ireplace("")); -var_dump(str_ireplace("", "")); var_dump(str_ireplace("", "", "")); var_dump(str_ireplace("tt", "a", "ttttTttttttttTT")); @@ -48,14 +45,6 @@ var_dump($Data = str_ireplace("\n", "<br>", $Data)); echo "Done\n"; ?> --EXPECTF-- -Warning: str_ireplace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: str_ireplace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_ireplace() expects at least 3 parameters, 2 given in %s on line %d -NULL string(0) "" string(8) "aaaaaaaT" string(8) "aaaaaaaT" diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt Binary files differindex b44a9517ab..be4c9ed942 100644 --- a/ext/standard/tests/strings/str_pad.phpt +++ b/ext/standard/tests/strings/str_pad.phpt diff --git a/ext/standard/tests/strings/str_repeat.phpt b/ext/standard/tests/strings/str_repeat.phpt Binary files differindex 306b7d381a..766bea1f9c 100644 --- a/ext/standard/tests/strings/str_repeat.phpt +++ b/ext/standard/tests/strings/str_repeat.phpt diff --git a/ext/standard/tests/strings/str_replace.phpt b/ext/standard/tests/strings/str_replace.phpt index 7b411abac5..bef11f872a 100644 --- a/ext/standard/tests/strings/str_replace.phpt +++ b/ext/standard/tests/strings/str_replace.phpt @@ -223,15 +223,6 @@ var_dump( str_replace("worldS", "FOUND", "$strS") ); var_dump( str_replace("worldS", "FOUND", "${str}S") ); var_dump( str_replace("worldS", "FOUND", "{$str}S") ); - -echo "\n*** Testing error conditions ***"; -/* Invalid arguments */ -var_dump( str_replace() ); -var_dump( str_replace("") ); -var_dump( str_replace(NULL) ); -var_dump( str_replace(1, 2) ); -var_dump( str_replace(1,2,3,$var,5) ); - fclose($resource1); closedir($resource2); echo "Done\n"; @@ -938,20 +929,4 @@ Notice: Undefined variable: strS in %s on line %d string(0) "" string(5) "FOUND" string(5) "FOUND" - -*** Testing error conditions *** -Warning: str_replace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 2 given in %s on line %d -NULL - -Warning: str_replace() expects at most 4 parameters, 5 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/strings/str_split_variation6.phpt b/ext/standard/tests/strings/str_split_variation6.phpt index a477800a26..1aea668026 100644 --- a/ext/standard/tests/strings/str_split_variation6.phpt +++ b/ext/standard/tests/strings/str_split_variation6.phpt @@ -30,7 +30,6 @@ $values = array ( 0234, //octal number 0x1A, //hexadecimal number 2147483647, //max positive integer number - 2147483648, //max positive integer+1 -2147483648, //min negative integer ); @@ -157,10 +156,6 @@ array(1) { } -- Iteration 7 -- -Warning: str_split() expects parameter 2 to be int, float given in %s line %d -NULL --- Iteration 8 -- - Warning: str_split(): The length of each segment must be greater than zero in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/str_split_variation7.phpt b/ext/standard/tests/strings/str_split_variation7.phpt index 5082c7ba2f..1a2471a20a 100644 --- a/ext/standard/tests/strings/str_split_variation7.phpt +++ b/ext/standard/tests/strings/str_split_variation7.phpt @@ -32,7 +32,6 @@ $values = array ( 0234, //octal number 0x1A, //hexadecimal number 2147483647, //max positive integer number - 2147483648, //max positive integer+1 -2147483648, //min negative integer ); @@ -135,10 +134,6 @@ array(1) { } -- Iteration 7 -- -Warning: str_split() expects parameter 2 to be int, float given in %s on line %d -NULL --- Iteration 8 -- - Warning: str_split(): The length of each segment must be greater than zero in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/str_word_count.phpt b/ext/standard/tests/strings/str_word_count.phpt index f88646370b..e8fa12aca6 100644 --- a/ext/standard/tests/strings/str_word_count.phpt +++ b/ext/standard/tests/strings/str_word_count.phpt @@ -13,28 +13,20 @@ var_dump(str_word_count($str, 3)); var_dump(str_word_count($str, 123)); var_dump(str_word_count($str, -1)); var_dump(str_word_count($str, 999999999)); -var_dump(str_word_count($str, array())); -var_dump(str_word_count($str, $b)); var_dump($str); $str2 = "F0o B4r 1s bar foo"; var_dump(str_word_count($str2, NULL, "04")); var_dump(str_word_count($str2, NULL, "01")); var_dump(str_word_count($str2, NULL, "014")); -var_dump(str_word_count($str2, NULL, array())); -var_dump(str_word_count($str2, NULL, new stdClass)); var_dump(str_word_count($str2, NULL, "")); var_dump(str_word_count($str2, 1, "04")); var_dump(str_word_count($str2, 1, "01")); var_dump(str_word_count($str2, 1, "014")); -var_dump(str_word_count($str2, 1, array())); -var_dump(str_word_count($str2, 1, new stdClass)); var_dump(str_word_count($str2, 1, "")); var_dump(str_word_count($str2, 2, "04")); var_dump(str_word_count($str2, 2, "01")); var_dump(str_word_count($str2, 2, "014")); -var_dump(str_word_count($str2, 2, array())); -var_dump(str_word_count($str2, 2, new stdClass)); var_dump(str_word_count($str2, 2, "")); var_dump(str_word_count("foo'0 bar-0var", 2, "0")); var_dump(str_word_count("'foo'", 2)); @@ -86,23 +78,11 @@ bool(false) Warning: str_word_count(): Invalid format value 999999999 in %s on line %d bool(false) - -Warning: str_word_count() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 2 to be int, string given in %s on line %d -NULL string(55) "Hello friend, you're looking good today!" int(5) int(6) int(5) - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL int(7) array(5) { [0]=> @@ -142,12 +122,6 @@ array(5) { [4]=> string(3) "foo" } - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL array(7) { [0]=> string(1) "F" @@ -202,12 +176,6 @@ array(5) { [15]=> string(3) "foo" } - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL array(7) { [0]=> string(1) "F" diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt Binary files differindex 3086c2be92..d9063cc9de 100644 --- a/ext/standard/tests/strings/strcasecmp.phpt +++ b/ext/standard/tests/strings/strcasecmp.phpt diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt Binary files differindex 397e072c52..fd20e50195 100644 --- a/ext/standard/tests/strings/strcmp.phpt +++ b/ext/standard/tests/strings/strcmp.phpt diff --git a/ext/standard/tests/strings/stripos_error.phpt b/ext/standard/tests/strings/stripos_error.phpt index 324014cf6d..0420bb090b 100644 --- a/ext/standard/tests/strings/stripos_error.phpt +++ b/ext/standard/tests/strings/stripos_error.phpt @@ -8,14 +8,6 @@ Test stripos() function : error conditions */ echo "*** Testing stripos() function: error conditions ***\n"; -echo "\n-- With Zero arguments --"; -var_dump( stripos() ); - -echo "\n-- With less than expected number of arguments --"; -var_dump( stripos("String") ); - -echo "\n-- With more than expected number of arguments --"; -var_dump( stripos("string", "String", 1, 'extra_arg') ); echo "\n-- Offset beyond the end of the string --"; var_dump( stripos("Hello World", "o", 12) ); @@ -28,18 +20,6 @@ echo "*** Done ***"; --EXPECTF-- *** Testing stripos() function: error conditions *** --- With Zero arguments -- -Warning: stripos() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- With less than expected number of arguments -- -Warning: stripos() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- With more than expected number of arguments -- -Warning: stripos() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Offset beyond the end of the string -- Warning: stripos(): Offset not contained in string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/stripos_variation10.phpt b/ext/standard/tests/strings/stripos_variation10.phpt index 81d3b35a20..6792b4d0b2 100644 --- a/ext/standard/tests/strings/stripos_variation10.phpt +++ b/ext/standard/tests/strings/stripos_variation10.phpt @@ -83,7 +83,11 @@ $needles = array ( $counter = 1; for($index = 0; $index < count($needles); $index ++) { echo "\n-- Iteration $counter --\n"; - var_dump( stripos($haystack, $needles[$index]) ); + try { + var_dump( stripos($haystack, $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -122,29 +126,19 @@ bool(false) int(17) -- Iteration 10 -- - -Warning: stripos() expects parameter 2 to be string, array given in %s on line %d -NULL +stripos() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: stripos() expects parameter 2 to be string, array given in %s on line %d -NULL +stripos() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: stripos() expects parameter 2 to be string, array given in %s on line %d -NULL +stripos() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: stripos() expects parameter 2 to be string, array given in %s on line %d -NULL +stripos() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: stripos() expects parameter 2 to be string, array given in %s on line %d -NULL +stripos() expects parameter 2 to be string, array given -- Iteration 15 -- int(9) @@ -174,9 +168,7 @@ bool(false) bool(false) -- Iteration 24 -- - -Warning: stripos() expects parameter 2 to be string, resource given in %s on line %d -NULL +stripos() expects parameter 2 to be string, resource given -- Iteration 25 -- bool(false) diff --git a/ext/standard/tests/strings/stripos_variation11.phpt b/ext/standard/tests/strings/stripos_variation11.phpt index 1f79b61d1a..aab3181df3 100644 --- a/ext/standard/tests/strings/stripos_variation11.phpt +++ b/ext/standard/tests/strings/stripos_variation11.phpt @@ -81,8 +81,16 @@ $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; $haystack = $values[$index]; - var_dump( stripos($values[$index], $values[$index]) ); - var_dump( stripos($values[$index], $values[$index], 1) ); + try { + var_dump( stripos($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( stripos($values[$index], $values[$index], 1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -118,40 +126,20 @@ bool(false) int(0) bool(false) -- Iteration 10 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 15 -- int(0) bool(false) @@ -192,12 +180,8 @@ bool(false) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 24 -- - -Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d -NULL +stripos() expects parameter 1 to be string, resource given +stripos() expects parameter 1 to be string, resource given -- Iteration 25 -- bool(false) diff --git a/ext/standard/tests/strings/stristr.phpt b/ext/standard/tests/strings/stristr.phpt index a0f0cc3497..92cfa09eb1 100644 --- a/ext/standard/tests/strings/stristr.phpt +++ b/ext/standard/tests/strings/stristr.phpt @@ -2,10 +2,6 @@ stristr() function --FILE-- <?php - var_dump(stristr()); - var_dump(stristr(array(), "")); - var_dump(stristr("", array())); - var_dump(stristr(array(), array())); var_dump(stristr("tEsT sTrInG", "tEsT")); var_dump(stristr("tEsT sTrInG", "stRiNg")); var_dump(stristr("tEsT sTrInG", "stRiN")); @@ -19,17 +15,6 @@ stristr() function var_dump(stristr("tEsT sTrInG", " ")); ?> --EXPECTF-- -Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stristr() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d -NULL string(11) "tEsT sTrInG" string(6) "sTrInG" string(6) "sTrInG" diff --git a/ext/standard/tests/strings/stristr_error.phpt b/ext/standard/tests/strings/stristr_error.phpt index a0057574f9..a7b683d3b8 100644 --- a/ext/standard/tests/strings/stristr_error.phpt +++ b/ext/standard/tests/strings/stristr_error.phpt @@ -8,17 +8,6 @@ Test stristr() function : error conditions */ echo "*** Testing stristr() : error conditions ***\n"; -echo "\n-- Testing stristr() function with no arguments --\n"; -var_dump( stristr() ); -var_dump( stristr("") ); - -echo "\n-- Testing stristr() function with no needle --\n"; -var_dump( stristr("Hello World") ); // without "needle" - -echo "\n-- Testing stristr() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( stristr("Hello World", "World", true, $extra_arg) ); - echo "\n-- Testing stristr() function with empty haystack --\n"; var_dump( stristr(NULL, "") ); @@ -30,24 +19,6 @@ var_dump( stristr("Hello World", "") ); --EXPECTF-- *** Testing stristr() : error conditions *** --- Testing stristr() function with no arguments -- - -Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing stristr() function with no needle -- - -Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing stristr() function with more than expected no. of arguments -- - -Warning: stristr() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Testing stristr() function with empty haystack -- Warning: stristr(): Empty needle in %s on line %d diff --git a/ext/standard/tests/strings/stristr_variation2.phpt b/ext/standard/tests/strings/stristr_variation2.phpt index 8ca09db66c..fd842d1106 100644 --- a/ext/standard/tests/strings/stristr_variation2.phpt +++ b/ext/standard/tests/strings/stristr_variation2.phpt @@ -72,7 +72,11 @@ $pad_length = "20"; $count = 1; foreach($inputs as $input) { echo "-- Iteration $count --\n"; - var_dump( stristr("Hello World", $input) ); + try { + var_dump( stristr("Hello World", $input) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count ++; } @@ -97,17 +101,11 @@ bool(false) -- Iteration 7 -- bool(false) -- Iteration 8 -- - -Warning: stristr() expects parameter 2 to be string, array given in %s on line %d -NULL +stristr() expects parameter 2 to be string, array given -- Iteration 9 -- - -Warning: stristr() expects parameter 2 to be string, array given in %s on line %d -NULL +stristr() expects parameter 2 to be string, array given -- Iteration 10 -- - -Warning: stristr() expects parameter 2 to be string, array given in %s on line %d -NULL +stristr() expects parameter 2 to be string, array given -- Iteration 11 -- bool(false) -- Iteration 12 -- @@ -131,9 +129,7 @@ bool(false) -- Iteration 17 -- bool(false) -- Iteration 18 -- - -Warning: stristr() expects parameter 2 to be string, resource given in %s on line %d -NULL +stristr() expects parameter 2 to be string, resource given -- Iteration 19 -- Warning: stristr(): Empty needle in %s on line %d diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt Binary files differindex a546bdb8d2..156038ed7b 100644 --- a/ext/standard/tests/strings/strlen.phpt +++ b/ext/standard/tests/strings/strlen.phpt diff --git a/ext/standard/tests/strings/strncasecmp_error.phpt b/ext/standard/tests/strings/strncasecmp_error.phpt index d443f8113b..00ddfaed9b 100644 --- a/ext/standard/tests/strings/strncasecmp_error.phpt +++ b/ext/standard/tests/strings/strncasecmp_error.phpt @@ -10,18 +10,6 @@ Test strncasecmp() function : error conditions echo "*** Testing strncasecmp() function: error conditions ***\n"; $str1 = 'string_val'; $str2 = 'string_val'; -$len = 10; -$extra_arg = 10; - -echo "\n-- Testing strncasecmp() function with Zero arguments --"; -var_dump( strncasecmp() ); - -echo "\n-- Testing strncasecmp() function with less than expected number of arguments --"; -var_dump( strncasecmp($str1) ); -var_dump( strncasecmp($str1, $str2) ); - -echo "\n-- Testing strncasecmp() function with more than expected number of arguments --"; -var_dump( strncasecmp($str1, $str2, $len, $extra_arg) ); echo "\n-- Testing strncasecmp() function with invalid argument --"; $len = -10; @@ -31,21 +19,6 @@ echo "*** Done ***\n"; --EXPECTF-- *** Testing strncasecmp() function: error conditions *** --- Testing strncasecmp() function with Zero arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 0 given in %s on line %d -NULL - --- Testing strncasecmp() function with less than expected number of arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: strncasecmp() expects exactly 3 parameters, 2 given in %s on line %d -NULL - --- Testing strncasecmp() function with more than expected number of arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 4 given in %s on line %d -NULL - -- Testing strncasecmp() function with invalid argument -- Warning: Length must be greater than or equal to 0 in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strncmp_error.phpt b/ext/standard/tests/strings/strncmp_error.phpt index 4eb73eb318..13a4cb0350 100644 --- a/ext/standard/tests/strings/strncmp_error.phpt +++ b/ext/standard/tests/strings/strncmp_error.phpt @@ -12,13 +12,6 @@ Test strncmp() function : error conditions echo "*** Testing strncmp() function: error conditions ***\n"; $str1 = 'string_val'; $str2 = 'string_val'; -$len = 10; -$extra_arg = 10; - -var_dump( strncmp() ); //Zero argument -var_dump( strncmp($str1) ); //One argument, less than expected no. of args -var_dump( strncmp($str1, $str2) ); //Two arguments, less than expected no. of args -var_dump( strncmp($str1, $str2, $len, $extra_arg) ); //Four arguments, greater than expected no. of args /* Invalid argument for $len */ $len = -10; @@ -28,18 +21,6 @@ echo "*** Done ***\n"; --EXPECTF-- *** Testing strncmp() function: error conditions *** -Warning: strncmp() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 2 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 4 given in %s on line %d -NULL - Warning: Length must be greater than or equal to 0 in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strpbrk_error.phpt b/ext/standard/tests/strings/strpbrk_error.phpt index 658e2f429e..cce843c2f1 100644 --- a/ext/standard/tests/strings/strpbrk_error.phpt +++ b/ext/standard/tests/strings/strpbrk_error.phpt @@ -11,47 +11,17 @@ Test strpbrk() function : error conditions echo "*** Testing strpbrk() : error conditions ***\n"; $haystack = 'This is a Simple text.'; -$char_list = 'string_val'; -$extra_arg = 10; - -echo "\n-- Testing strpbrk() function with more than expected no. of arguments --\n"; -var_dump( strpbrk($haystack, $char_list, $extra_arg) ); - -echo "\n-- Testing strpbrk() function with less than expected no. of arguments --\n"; -var_dump( strpbrk($haystack) ); echo "\n-- Testing strpbrk() function with empty second argument --\n"; var_dump( strpbrk($haystack, '') ); -echo "\n-- Testing strpbrk() function with arrays --\n"; -var_dump( strpbrk($haystack, array('a', 'b', 'c') ) ); -var_dump( strpbrk(array('foo', 'bar'), 'b') ); - ?> ===DONE=== --EXPECTF-- *** Testing strpbrk() : error conditions *** --- Testing strpbrk() function with more than expected no. of arguments -- - -Warning: strpbrk() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) - --- Testing strpbrk() function with less than expected no. of arguments -- - -Warning: strpbrk() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) - -- Testing strpbrk() function with empty second argument -- Warning: strpbrk(): The character list cannot be empty in %s on line %d bool(false) - --- Testing strpbrk() function with arrays -- - -Warning: strpbrk() expects parameter 2 to be string, array given in %s on line %d -bool(false) - -Warning: strpbrk() expects parameter 1 to be string, array given in %s on line %d -bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt Binary files differindex a4c3a9c781..4640b670f3 100644 --- a/ext/standard/tests/strings/strpos.phpt +++ b/ext/standard/tests/strings/strpos.phpt diff --git a/ext/standard/tests/strings/strrchr_variation10.phpt b/ext/standard/tests/strings/strrchr_variation10.phpt index 478ac80300..1004a3d915 100644 --- a/ext/standard/tests/strings/strrchr_variation10.phpt +++ b/ext/standard/tests/strings/strrchr_variation10.phpt @@ -121,7 +121,11 @@ $needles = array ( $count = 1; for($index = 0; $index < count($haystacks); $index++) { echo "-- Iteration $count --\n"; - var_dump( strrchr($haystacks[$index], $needles[$index]) ); + try { + var_dump( strrchr($haystacks[$index], $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count ++; } @@ -129,7 +133,7 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrchr() function with unexpected inputs for needle *** -- Iteration 1 -- string(1) "0" @@ -150,25 +154,15 @@ string(2) "10" -- Iteration 9 -- bool(false) -- Iteration 10 -- - -Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 2 to be string, array given -- Iteration 15 -- bool(false) -- Iteration 16 -- @@ -188,9 +182,7 @@ bool(false) -- Iteration 23 -- bool(false) -- Iteration 24 -- - -Warning: strrchr() expects parameter 2 to be string, resource given in %s on line %d -NULL +strrchr() expects parameter 2 to be string, resource given -- Iteration 25 -- bool(false) -- Iteration 26 -- diff --git a/ext/standard/tests/strings/strrchr_variation11.phpt b/ext/standard/tests/strings/strrchr_variation11.phpt index 92a9c07eee..79ffe4c2ec 100644 --- a/ext/standard/tests/strings/strrchr_variation11.phpt +++ b/ext/standard/tests/strings/strrchr_variation11.phpt @@ -80,7 +80,11 @@ $values = array ( $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; - var_dump( strrchr($values[$index], $values[$index]) ); + try { + var_dump( strrchr($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -88,7 +92,7 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrchr() function: with unexpected inputs for haystack and needle *** -- Iteration 1 -- string(1) "0" @@ -109,25 +113,15 @@ string(4) "1E-9" -- Iteration 9 -- string(3) "0.5" -- Iteration 10 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 15 -- string(1) "1" -- Iteration 16 -- @@ -147,9 +141,7 @@ bool(false) -- Iteration 23 -- bool(false) -- Iteration 24 -- - -Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, resource given -- Iteration 25 -- bool(false) -- Iteration 26 -- diff --git a/ext/standard/tests/strings/strripos.phpt b/ext/standard/tests/strings/strripos.phpt index 291ff78cd7..fa15e2fcac 100644 --- a/ext/standard/tests/strings/strripos.phpt +++ b/ext/standard/tests/strings/strripos.phpt @@ -15,9 +15,6 @@ strripos() function var_dump(@strripos("a", "")); var_dump(@strripos("", "a")); var_dump(@strripos("\\\\a", "\\a")); - - $fp = fopen(__FILE__, "r"); - var_dump(@strripos("", $fp)); ?> --EXPECT-- int(5) @@ -33,4 +30,3 @@ bool(false) bool(false) bool(false) int(1) -bool(false) diff --git a/ext/standard/tests/strings/strripos_offset.phpt b/ext/standard/tests/strings/strripos_offset.phpt index b5d09d7946..5981c9b6cb 100644 --- a/ext/standard/tests/strings/strripos_offset.phpt +++ b/ext/standard/tests/strings/strripos_offset.phpt @@ -3,11 +3,12 @@ strripos() offset integer overflow --FILE-- <?php -var_dump(strripos("t", "t", PHP_INT_MAX+1)); -var_dump(strripos("tttt", "tt", PHP_INT_MAX+1)); -var_dump(strripos(100, 101, PHP_INT_MAX+1)); -var_dump(strripos(1024, 1024, PHP_INT_MAX+1)); -var_dump(strripos(array(), array(), PHP_INT_MAX+1)); +try { + var_dump(strripos("t", "t", PHP_INT_MAX+1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + var_dump(strripos(1024, 1024, -PHP_INT_MAX)); var_dump(strripos(1024, "te", -PHP_INT_MAX)); var_dump(strripos(1024, 1024, -PHP_INT_MAX-1)); @@ -16,20 +17,7 @@ var_dump(strripos(1024, "te", -PHP_INT_MAX-1)); echo "Done\n"; ?> --EXPECTF-- -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strripos() expects parameter 3 to be int, float given Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strrpos_offset.phpt b/ext/standard/tests/strings/strrpos_offset.phpt index 1399b60985..d1bbc856a3 100644 --- a/ext/standard/tests/strings/strrpos_offset.phpt +++ b/ext/standard/tests/strings/strrpos_offset.phpt @@ -3,10 +3,12 @@ strrpos() offset integer overflow --FILE-- <?php -var_dump(strrpos("t", "t", PHP_INT_MAX+1)); -var_dump(strrpos("tttt", "tt", PHP_INT_MAX+1)); -var_dump(strrpos(100, 101, PHP_INT_MAX+1)); -var_dump(strrpos(1024, 1024, PHP_INT_MAX+1)); +try { + var_dump(strrpos("t", "t", PHP_INT_MAX+1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + var_dump(strrpos(1024, 1024, -PHP_INT_MAX)); var_dump(strrpos(1024, "te", -PHP_INT_MAX)); var_dump(strrpos(1024, 1024, -PHP_INT_MAX-1)); @@ -15,17 +17,7 @@ var_dump(strrpos(1024, "te", -PHP_INT_MAX-1)); echo "Done\n"; ?> --EXPECTF-- -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) +strrpos() expects parameter 3 to be int, float given Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strrpos_variation10.phpt b/ext/standard/tests/strings/strrpos_variation10.phpt index b374e7f9f6..440605d430 100644 --- a/ext/standard/tests/strings/strrpos_variation10.phpt +++ b/ext/standard/tests/strings/strrpos_variation10.phpt @@ -83,7 +83,11 @@ $needles = array ( $counter = 1; for($index = 0; $index < count($needles); $index ++) { echo "-- Iteration $counter --\n"; - var_dump( strrpos($haystack, $needles[$index]) ); + try { + var_dump( strrpos($haystack, $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -91,7 +95,7 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function with unexpected values for needle *** -- Iteration 1 -- int(42) @@ -112,25 +116,15 @@ bool(false) -- Iteration 9 -- int(28) -- Iteration 10 -- - -Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 15 -- int(41) -- Iteration 16 -- @@ -150,9 +144,7 @@ bool(false) -- Iteration 23 -- bool(false) -- Iteration 24 -- - -Warning: strrpos() expects parameter 2 to be string, resource given in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, resource given -- Iteration 25 -- bool(false) -- Iteration 26 -- diff --git a/ext/standard/tests/strings/strrpos_variation11.phpt b/ext/standard/tests/strings/strrpos_variation11.phpt index f628427f08..71201a1c21 100644 --- a/ext/standard/tests/strings/strrpos_variation11.phpt +++ b/ext/standard/tests/strings/strrpos_variation11.phpt @@ -81,14 +81,22 @@ $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; $haystack = $values[$index]; - var_dump( strrpos($values[$index], $values[$index]) ); - var_dump( strrpos($values[$index], $values[$index], 1) ); + try { + var_dump( strrpos($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( strrpos($values[$index], $values[$index], 1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function with unexpected values for haystack and needle *** -- Iteration 1 -- int(0) @@ -118,40 +126,20 @@ bool(false) int(0) bool(false) -- Iteration 10 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 15 -- int(0) bool(false) @@ -180,12 +168,8 @@ bool(false) bool(false) bool(false) -- Iteration 24 -- - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, resource given +strrpos() expects parameter 1 to be string, resource given -- Iteration 25 -- bool(false) bool(false) diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt Binary files differindex cc3b7c5453..6bdc3feab1 100644 --- a/ext/standard/tests/strings/strstr.phpt +++ b/ext/standard/tests/strings/strstr.phpt diff --git a/ext/standard/tests/strings/strtolower-win32.phpt b/ext/standard/tests/strings/strtolower-win32.phpt Binary files differindex c0ad1d0115..ff631754df 100644 --- a/ext/standard/tests/strings/strtolower-win32.phpt +++ b/ext/standard/tests/strings/strtolower-win32.phpt diff --git a/ext/standard/tests/strings/strtolower.phpt b/ext/standard/tests/strings/strtolower.phpt Binary files differindex 47dfe09762..7c7e2bb4c7 100644 --- a/ext/standard/tests/strings/strtolower.phpt +++ b/ext/standard/tests/strings/strtolower.phpt diff --git a/ext/standard/tests/strings/strtoupper1-win32.phpt b/ext/standard/tests/strings/strtoupper1-win32.phpt Binary files differindex 60701652e1..7240e5c021 100644 --- a/ext/standard/tests/strings/strtoupper1-win32.phpt +++ b/ext/standard/tests/strings/strtoupper1-win32.phpt diff --git a/ext/standard/tests/strings/strtoupper1.phpt b/ext/standard/tests/strings/strtoupper1.phpt Binary files differindex e0ebf42ea7..c243ff10c7 100644 --- a/ext/standard/tests/strings/strtoupper1.phpt +++ b/ext/standard/tests/strings/strtoupper1.phpt diff --git a/ext/standard/tests/strings/strval_error.phpt b/ext/standard/tests/strings/strval_error.phpt index 37ecfd14d5..acf3cc623a 100644 --- a/ext/standard/tests/strings/strval_error.phpt +++ b/ext/standard/tests/strings/strval_error.phpt @@ -16,17 +16,6 @@ class MyClass // no toString() method defined } -$string = "Hello"; -$extra_arg = 10; - -//Test strval with one more than the expected number of arguments -echo "\n-- Testing strval() function with more than expected no. of arguments --\n"; -var_dump( strval($string, $extra_arg) ); - -// Testing strval with one less than the expected number of arguments -echo "\n-- Testing strval() function with less than expected no. of arguments --\n"; -var_dump( strval() ); - // Testing strval with a object which has no toString() method echo "\n-- Testing strval() function with object which has not toString() method --\n"; var_dump( strval(new MyClass()) ); @@ -36,16 +25,6 @@ var_dump( strval(new MyClass()) ); --EXPECTF-- *** Testing strval() : error conditions *** --- Testing strval() function with more than expected no. of arguments -- - -Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Testing strval() function with less than expected no. of arguments -- - -Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -- Testing strval() function with object which has not toString() method -- Recoverable fatal error: Object of class MyClass could not be converted to string in %s on line %d diff --git a/ext/standard/tests/strings/substr.phpt b/ext/standard/tests/strings/substr.phpt Binary files differindex 0901d2082e..18e7cd1781 100644 --- a/ext/standard/tests/strings/substr.phpt +++ b/ext/standard/tests/strings/substr.phpt diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt index 1fdf1b144f..2e3256631c 100644 --- a/ext/standard/tests/strings/substr_compare.phpt +++ b/ext/standard/tests/strings/substr_compare.phpt @@ -12,11 +12,9 @@ var_dump(substr_compare("abcde", "cd", 1, 2) < 0); var_dump(substr_compare("abcde", "abc", 5, 1)); var_dump(substr_compare("abcde", "abcdef", -10, 10) < 0); var_dump(substr_compare("abcde", "abc", 0, 0)); -var_dump(substr_compare("abcde", -1, 0, NULL, new stdClass)); echo "Test\n"; var_dump(substr_compare("abcde", "abc", 0, -1)); var_dump(substr_compare("abcde", "abc", -1, NULL, -5) > 0); -var_dump(substr_compare("abcde", -1, 0, "str", new stdClass)); echo "Done\n"; ?> @@ -32,15 +30,9 @@ Warning: substr_compare(): The start position cannot exceed initial string lengt bool(false) bool(true) int(0) - -Warning: substr_compare() expects parameter 5 to be bool, object given in %s on line %d -bool(false) Test Warning: substr_compare(): The length must be greater than or equal to zero in %s on line %d bool(false) bool(true) - -Warning: substr_compare() expects parameter 4 to be int, string given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/strings/substr_count_error.phpt b/ext/standard/tests/strings/substr_count_error.phpt index eecc251e6c..246963d13b 100644 --- a/ext/standard/tests/strings/substr_count_error.phpt +++ b/ext/standard/tests/strings/substr_count_error.phpt @@ -6,12 +6,6 @@ Test substr_count() function (error conditions) echo "\n*** Testing error conditions ***\n"; $str = 'abcdefghik'; -/* Zero argument */ -var_dump( substr_count() ); - -/* more than expected no. of args */ -var_dump( substr_count($str, "t", 0, 15, 30) ); - /* offset before start */ var_dump(substr_count($str, "t", -20)); @@ -22,9 +16,6 @@ var_dump(substr_count($str, "t", 25)); Warning message expected, as length+offset > length of string */ var_dump( substr_count($str, "i", 5, 7) ); -/* Invalid offset argument */ -var_dump( substr_count($str, "t", "") ); - /* length too small */ var_dump( substr_count($str, "t", 2, -20) ); @@ -34,12 +25,6 @@ echo "Done\n"; --EXPECTF-- *** Testing error conditions *** -Warning: substr_count() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: substr_count() expects at most 4 parameters, 5 given in %s on line %d -NULL - Warning: substr_count(): Offset not contained in string in %s on line %d bool(false) @@ -49,9 +34,6 @@ bool(false) Warning: substr_count(): Invalid length value in %s on line %d bool(false) -Warning: substr_count() expects parameter 3 to be int, string given in %s on line %d -NULL - Warning: substr_count(): Invalid length value in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/substr_count_variation_001.phpt b/ext/standard/tests/strings/substr_count_variation_001.phpt index 71f2d223e1..19a9a0310d 100644 --- a/ext/standard/tests/strings/substr_count_variation_001.phpt +++ b/ext/standard/tests/strings/substr_count_variation_001.phpt @@ -12,9 +12,6 @@ var_dump( substr_count($str, "i", "5t") ); var_dump( substr_count($str, "i", "5t", "10t") ); echo "\n-- 3rd or 4th arg as NULL --\n"; -var_dump( substr_count($str, "t", "") ); -var_dump( substr_count($str, "T", "") ); -var_dump( substr_count($str, "t", "", 15) ); var_dump( substr_count($str, "I", NULL) ); var_dump( substr_count($str, "i", NULL, 10) ); @@ -67,15 +64,6 @@ Notice: A non well formed numeric value encountered in %s on line %d int(2) -- 3rd or 4th arg as NULL -- - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL int(0) int(2) diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt index ac945349fe..936d0fd1d5 100644 --- a/ext/standard/tests/strings/substr_replace_error.phpt +++ b/ext/standard/tests/strings/substr_replace_error.phpt @@ -15,13 +15,6 @@ echo "*** Testing substr_replace() : error conditions ***\n"; $s1 = "Good morning"; -echo "\n-- Testing substr_replace() function with less than expected no. of arguments --\n"; -var_dump(substr_replace()); -var_dump(substr_replace($s1, "evening")); - -echo "\n-- Testing substr_replace() function with more than expected no. of arguments --\n"; -var_dump(substr_replace($s1, "evening", 5, 7, true)); - echo "\n-- Testing substr_replace() function with start and length different types --\n"; var_dump(substr_replace($s1, "evening", array(5))); var_dump(substr_replace($s1, "evening", 5, array(8))); @@ -37,19 +30,6 @@ var_dump(substr_replace($s1, "evening", array(5), array(8))); --EXPECTF-- *** Testing substr_replace() : error conditions *** --- Testing substr_replace() function with less than expected no. of arguments -- - -Warning: substr_replace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: substr_replace() expects at least 3 parameters, 2 given in %s on line %d -NULL - --- Testing substr_replace() function with more than expected no. of arguments -- - -Warning: substr_replace() expects at most 4 parameters, 5 given in %s on line %d -NULL - -- Testing substr_replace() function with start and length different types -- Warning: substr_replace(): 'start' and 'length' should be of same type - numerical or array in %s on line %d diff --git a/ext/standard/tests/strings/trim1.phpt b/ext/standard/tests/strings/trim1.phpt Binary files differindex d0e4070d80..1ad504c61d 100644 --- a/ext/standard/tests/strings/trim1.phpt +++ b/ext/standard/tests/strings/trim1.phpt diff --git a/ext/standard/tests/strings/trim_error.phpt b/ext/standard/tests/strings/trim_error.phpt index b845cee1ac..046a2b04f9 100644 --- a/ext/standard/tests/strings/trim_error.phpt +++ b/ext/standard/tests/strings/trim_error.phpt @@ -11,14 +11,6 @@ Test trim() function : error conditions echo "*** Testing trim() : error conditions ***\n"; -echo "\n-- Testing trim() function with no arguments --\n"; -var_dump( trim() ); - -echo "\n-- Testing trim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( trim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test trim function with various invalid charlists --\n"; var_dump(trim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(trim($hello, "a..b..c")); --EXPECTF-- *** Testing trim() : error conditions *** --- Testing trim() function with no arguments -- - -Warning: trim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing trim() function with more than expected no. of arguments -- - -Warning: trim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test trim function with various invalid charlists -- Warning: trim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt Binary files differindex 0b177a8565..3508881d3c 100644 --- a/ext/standard/tests/strings/ucfirst.phpt +++ b/ext/standard/tests/strings/ucfirst.phpt diff --git a/ext/standard/tests/strings/unpack_error.phpt b/ext/standard/tests/strings/unpack_error.phpt index f04e493772..b34be23267 100644 --- a/ext/standard/tests/strings/unpack_error.phpt +++ b/ext/standard/tests/strings/unpack_error.phpt @@ -10,13 +10,6 @@ Test unpack() function : error conditions echo "*** Testing unpack() : error conditions ***\n"; -echo "\n-- Testing unpack() function with no arguments --\n"; -var_dump( unpack() ); - -echo "\n-- Testing unpack() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump(unpack("I", pack("I", 65534), 0, $extra_arg)); - echo "\n-- Testing unpack() function with invalid format character --\n"; $extra_arg = 10; var_dump(unpack("B", pack("I", 65534))); @@ -25,16 +18,6 @@ var_dump(unpack("B", pack("I", 65534))); --EXPECTF-- *** Testing unpack() : error conditions *** --- Testing unpack() function with no arguments -- - -Warning: unpack() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing unpack() function with more than expected no. of arguments -- - -Warning: unpack() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Testing unpack() function with invalid format character -- Warning: unpack(): Invalid format type B in %s on line %d diff --git a/ext/standard/tests/strings/uuencode.phpt b/ext/standard/tests/strings/uuencode.phpt index 5a1f3d2a24..8199a2ed05 100644 --- a/ext/standard/tests/strings/uuencode.phpt +++ b/ext/standard/tests/strings/uuencode.phpt @@ -3,9 +3,6 @@ uuencode family tests --FILE-- <?php -var_dump(convert_uuencode(array())); -var_dump(convert_uudecode(array())); - var_dump(convert_uuencode("")); var_dump(convert_uudecode("")); var_dump($enc = convert_uuencode("~!@#$%^&*()_}{POIUYTREWQQSDFGHJKL:<MNBVCXZ")); @@ -18,11 +15,6 @@ var_dump(convert_uudecode(substr($enc, 0, -10))); echo "Done\n"; ?> --EXPECTF-- -Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d -bool(false) bool(false) bool(false) string(60) "J?B%`(R0E7B8J*"E??7M03TE5651215=145-$1D=(2DM,.CQ-3D)60UA: diff --git a/ext/standard/tests/strings/vfprintf_error1.phpt b/ext/standard/tests/strings/vfprintf_error1.phpt index c56631ecd7..b4548e8b49 100644 --- a/ext/standard/tests/strings/vfprintf_error1.phpt +++ b/ext/standard/tests/strings/vfprintf_error1.phpt @@ -20,8 +20,16 @@ echo "\n-- Testing vfprintf() function with more than expected no. of arguments $format = 'string_val'; $args = array( 1, 2 ); $extra_arg = 10; -var_dump( vfprintf( $fp, $format, $args, $extra_arg ) ); -var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) ); +try { + var_dump( vfprintf( $fp, $format, $args, $extra_arg ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // Close handle fclose($fp); @@ -37,10 +45,6 @@ unlink( $file ); ?> --EXPECTF-- -- Testing vfprintf() function with more than expected no. of arguments -- - -Warning: Wrong parameter count for vfprintf() in %s on line %d -NULL - -Warning: Wrong parameter count for vfprintf() in %s on line %d -NULL +Wrong parameter count for vfprintf() +Wrong parameter count for vfprintf() ===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_error4.phpt b/ext/standard/tests/strings/vfprintf_error4.phpt index 2865d42a9e..e54e34f4cd 100644 --- a/ext/standard/tests/strings/vfprintf_error4.phpt +++ b/ext/standard/tests/strings/vfprintf_error4.phpt @@ -17,7 +17,11 @@ $file = 'vfprintf_error4.txt'; $fp = fopen( $file, "a+" ); echo "\n-- Testing vfprintf() function with other strangeties --\n"; -var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) ); +try { + var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump( vfprintf( $fp, 'Foo %$c-0202Sd', array( 2 ) ) ); // Close handle @@ -34,9 +38,7 @@ unlink( $file ); ?> --EXPECTF-- -- Testing vfprintf() function with other strangeties -- - -Warning: vfprintf() expects parameter 1 to be resource, string given in %s on line %d -bool(false) +vfprintf() expects parameter 1 to be resource, string given Warning: vfprintf(): Argument number must be greater than zero in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/vfprintf_variation1.phpt b/ext/standard/tests/strings/vfprintf_variation1.phpt index 76422011c2..7c969ffff9 100644 --- a/ext/standard/tests/strings/vfprintf_variation1.phpt +++ b/ext/standard/tests/strings/vfprintf_variation1.phpt @@ -48,8 +48,6 @@ writeAndDump( $fp, "%s %s %s", array( 'bar', 'bar', 'bar' ) ); writeAndDump( $fp, "%02d", array( 50 ) ); writeAndDump( $fp, "", array() ); writeAndDump( $fp, "Testing %b %d %f %o %s %x %X", array( 9, 6, 2.5502, 24, "foobar", 15, 65 ) ); -@writeAndDump( $funset, "Foo with %s", array( 'string' ) ); -@writeAndDump( new FooClass(), "Foo with %s", array( 'string' ) ); // Close handle fclose( $fp ); @@ -79,8 +77,4 @@ string(0) "" int(0) string(38) "Testing 1001 6 2.550200 30 foobar f 41" int(38) -bool(false) -bool(false) -bool(false) -bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/wordwrap_error.phpt b/ext/standard/tests/strings/wordwrap_error.phpt index 41c5cbdb69..ad75461d3d 100644 --- a/ext/standard/tests/strings/wordwrap_error.phpt +++ b/ext/standard/tests/strings/wordwrap_error.phpt @@ -9,19 +9,10 @@ Test wordwrap() function : error conditions echo "*** Testing wordwrap() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing wordwrap() function with Zero arguments --\n"; -var_dump( wordwrap() ); - -// More than expected number of arguments -echo "\n-- Testing wordwrap() function with more than expected no. of arguments --\n"; $str = 'testing wordwrap function'; $width = 10; $break = '<br />\n'; $cut = true; -$extra_arg = "extra_arg"; - -var_dump( wordwrap($str, $width, $break, $cut, $extra_arg) ); // $width arg as negative value echo "\n-- Testing wordwrap() function with negative/zero value for width argument --\n"; @@ -54,16 +45,6 @@ echo "Done\n"; --EXPECTF-- *** Testing wordwrap() : error conditions *** --- Testing wordwrap() function with Zero arguments -- - -Warning: wordwrap() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing wordwrap() function with more than expected no. of arguments -- - -Warning: wordwrap() expects at most 4 parameters, 5 given in %s on line %d -NULL - -- Testing wordwrap() function with negative/zero value for width argument -- -- width = 0 & cut = false -- string(39) "testing<br />\nwordwrap<br />\nfunction" diff --git a/ext/standard/tests/time/strptime_error.phpt b/ext/standard/tests/time/strptime_error.phpt index f49025be44..3f7bbbdb82 100644 --- a/ext/standard/tests/time/strptime_error.phpt +++ b/ext/standard/tests/time/strptime_error.phpt @@ -19,20 +19,8 @@ date_default_timezone_set("Europe/London"); echo "*** Testing strptime() : error conditions ***\n"; -echo "\n-- Testing strptime() function with Zero arguments --\n"; -var_dump( strptime() ); - -echo "\n-- Testing strptime() function with less than expected no. of arguments --\n"; -$format = '%b %d %Y %H:%M:%S'; -$timestamp = mktime(8, 8, 8, 8, 8, 2008); -$date = strftime($format, $timestamp); -var_dump( strptime($date) ); - -echo "\n-- Testing strptime() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( strptime($date, $format, $extra_arg) ); - echo "\n-- Testing strptime() function on failure --\n"; +$format = '%b %d %Y %H:%M:%S'; var_dump( strptime('foo', $format) ); ?> @@ -40,21 +28,6 @@ var_dump( strptime('foo', $format) ); --EXPECTF-- *** Testing strptime() : error conditions *** --- Testing strptime() function with Zero arguments -- - -Warning: strptime() expects exactly 2 parameters, 0 given in %s on line %d -NULL - --- Testing strptime() function with less than expected no. of arguments -- - -Warning: strptime() expects exactly 2 parameters, 1 given in %s on line %d -NULL - --- Testing strptime() function with more than expected no. of arguments -- - -Warning: strptime() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -- Testing strptime() function on failure -- bool(false) ===DONE=== |