diff options
Diffstat (limited to 'ext/standard/tests/array')
184 files changed, 2721 insertions, 10126 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_chunk.phpt b/ext/standard/tests/array/array_chunk.phpt deleted file mode 100644 index 2ee77e129c..0000000000 --- a/ext/standard/tests/array/array_chunk.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -array_chunk() ---FILE-- -<?php -$array = array (); -var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); - echo "\n"; -} -?> ---EXPECT-- -array(0) { -} -[0] -NULL -NULL -NULL diff --git a/ext/standard/tests/array/array_chunk2.phpt b/ext/standard/tests/array/array_chunk2.phpt index 6d8b74545e..c02194aa5b 100644 --- a/ext/standard/tests/array/array_chunk2.phpt +++ b/ext/standard/tests/array/array_chunk2.phpt @@ -3,8 +3,19 @@ basic array_chunk test --FILE-- <?php $input_array = array('a', 'b', 'c', 'd', 'e'); -var_dump(array_chunk($input_array, 0)); -var_dump(array_chunk($input_array, 0, true)); + +try { + var_dump(array_chunk($input_array, 0)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(array_chunk($input_array, 0, true)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + var_dump(array_chunk($input_array, 1)); var_dump(array_chunk($input_array, 1, true)); var_dump(array_chunk($input_array, 2)); @@ -12,12 +23,9 @@ var_dump(array_chunk($input_array, 2, true)); var_dump(array_chunk($input_array, 10)); var_dump(array_chunk($input_array, 10, true)); ?> ---EXPECTF-- -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL +--EXPECT-- +Size parameter expected to be greater than 0 +Size parameter expected to be greater than 0 array(5) { [0]=> array(1) { diff --git a/ext/standard/tests/array/array_chunk_variation10.phpt b/ext/standard/tests/array/array_chunk_variation10.phpt index 7b4bee172b..be5fcdc7f3 100644 --- a/ext/standard/tests/array/array_chunk_variation10.phpt +++ b/ext/standard/tests/array/array_chunk_variation10.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 10 <?php $array = array (1 => 1, 2 => 2, 3 => 3); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -21,11 +21,6 @@ array(3) { [3]=> int(3) } -[0] -NULL -NULL -NULL - [1] array(3) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation11.phpt b/ext/standard/tests/array/array_chunk_variation11.phpt index dca366652d..09ec255744 100644 --- a/ext/standard/tests/array/array_chunk_variation11.phpt +++ b/ext/standard/tests/array/array_chunk_variation11.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 11 $array = array (0 => 0, 3 => 2); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -20,11 +20,6 @@ array(2) { [3]=> int(2) } -[0] -NULL -NULL -NULL - [1] array(2) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation12.phpt b/ext/standard/tests/array/array_chunk_variation12.phpt index 3b87dbab95..f85f2a8c0d 100644 --- a/ext/standard/tests/array/array_chunk_variation12.phpt +++ b/ext/standard/tests/array/array_chunk_variation12.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 12 <?php $array = array (1 => 1, 5 => 2, 8 => 3); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -21,11 +21,6 @@ array(3) { [8]=> int(3) } -[0] -NULL -NULL -NULL - [1] array(3) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation13.phpt b/ext/standard/tests/array/array_chunk_variation13.phpt index f6369df1c8..5cd6f0ea34 100644 --- a/ext/standard/tests/array/array_chunk_variation13.phpt +++ b/ext/standard/tests/array/array_chunk_variation13.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 13 <?php $array = array (1, 2); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -19,11 +19,6 @@ array(2) { [1]=> int(2) } -[0] -NULL -NULL -NULL - [1] array(2) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation14.phpt b/ext/standard/tests/array/array_chunk_variation14.phpt index f8d1b11790..97fce1e722 100644 --- a/ext/standard/tests/array/array_chunk_variation14.phpt +++ b/ext/standard/tests/array/array_chunk_variation14.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 14 <?php $array = array (0, 1, 2); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -21,11 +21,6 @@ array(3) { [2]=> int(2) } -[0] -NULL -NULL -NULL - [1] array(3) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation15.phpt b/ext/standard/tests/array/array_chunk_variation15.phpt index abec754a3d..c48af63f6c 100644 --- a/ext/standard/tests/array/array_chunk_variation15.phpt +++ b/ext/standard/tests/array/array_chunk_variation15.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 15 <?php $array = array (1, 2, 3); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -21,11 +21,6 @@ array(3) { [2]=> int(3) } -[0] -NULL -NULL -NULL - [1] array(3) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation16.phpt b/ext/standard/tests/array/array_chunk_variation16.phpt index 18179c8b07..3426f9278b 100644 --- a/ext/standard/tests/array/array_chunk_variation16.phpt +++ b/ext/standard/tests/array/array_chunk_variation16.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 16 <?php $array = array (0, 1, 2, 3); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -23,11 +23,6 @@ array(4) { [3]=> int(3) } -[0] -NULL -NULL -NULL - [1] array(4) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation17.phpt b/ext/standard/tests/array/array_chunk_variation17.phpt index 27507ea8cd..1a8bb5d340 100644 --- a/ext/standard/tests/array/array_chunk_variation17.phpt +++ b/ext/standard/tests/array/array_chunk_variation17.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 17 <?php $array = array (1, 2, 3, 4); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -23,11 +23,6 @@ array(4) { [3]=> int(4) } -[0] -NULL -NULL -NULL - [1] array(4) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation18.phpt b/ext/standard/tests/array/array_chunk_variation18.phpt index 7f0946f497..593c702ce9 100644 --- a/ext/standard/tests/array/array_chunk_variation18.phpt +++ b/ext/standard/tests/array/array_chunk_variation18.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 18 <?php $array = array (0, 1, 2, 3, 4); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -25,11 +25,6 @@ array(5) { [4]=> int(4) } -[0] -NULL -NULL -NULL - [1] array(5) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation19.phpt b/ext/standard/tests/array/array_chunk_variation19.phpt index d51389c9f3..f160cba263 100644 --- a/ext/standard/tests/array/array_chunk_variation19.phpt +++ b/ext/standard/tests/array/array_chunk_variation19.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 19 <?php $array = array (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -35,11 +35,6 @@ array(10) { [9]=> int(10) } -[0] -NULL -NULL -NULL - [1] array(10) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation20.phpt b/ext/standard/tests/array/array_chunk_variation20.phpt index cd5314ff04..d47279915c 100644 --- a/ext/standard/tests/array/array_chunk_variation20.phpt +++ b/ext/standard/tests/array/array_chunk_variation20.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 20 <?php $array = array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -37,11 +37,6 @@ array(11) { [10]=> int(10) } -[0] -NULL -NULL -NULL - [1] array(11) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation21.phpt b/ext/standard/tests/array/array_chunk_variation21.phpt index 678bf16751..e8c7784325 100644 --- a/ext/standard/tests/array/array_chunk_variation21.phpt +++ b/ext/standard/tests/array/array_chunk_variation21.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 21 <?php $array = array ("a" => 1); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { ["a"]=> int(1) } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation22.phpt b/ext/standard/tests/array/array_chunk_variation22.phpt index 45c458ebf9..b0eeade3ab 100644 --- a/ext/standard/tests/array/array_chunk_variation22.phpt +++ b/ext/standard/tests/array/array_chunk_variation22.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 22 <?php $array = array ("b" => 1, "c" => 2); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -19,11 +19,6 @@ array(2) { ["c"]=> int(2) } -[0] -NULL -NULL -NULL - [1] array(2) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation23.phpt b/ext/standard/tests/array/array_chunk_variation23.phpt index 80b92985b1..87ced15132 100644 --- a/ext/standard/tests/array/array_chunk_variation23.phpt +++ b/ext/standard/tests/array/array_chunk_variation23.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 23 <?php $array = array ("p" => 1, "q" => 2, "r" => 3, "s" => 4, "u" => 5, "v" => 6); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -27,11 +27,6 @@ array(6) { ["v"]=> int(6) } -[0] -NULL -NULL -NULL - [1] array(6) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation24.phpt b/ext/standard/tests/array/array_chunk_variation24.phpt index e25f53f6b6..69dce7be17 100644 --- a/ext/standard/tests/array/array_chunk_variation24.phpt +++ b/ext/standard/tests/array/array_chunk_variation24.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 24 <?php $array = array ("a" => "A"); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { ["a"]=> string(1) "A" } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation25.phpt b/ext/standard/tests/array/array_chunk_variation25.phpt index eae89e952b..09303c30ba 100644 --- a/ext/standard/tests/array/array_chunk_variation25.phpt +++ b/ext/standard/tests/array/array_chunk_variation25.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 25 <?php $array = array ("p" => "A", "q" => "B", "r" => "C", "s" => "D", "u" => "E", "v" => "F"); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -27,11 +27,6 @@ array(6) { ["v"]=> string(1) "F" } -[0] -NULL -NULL -NULL - [1] array(6) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation26.phpt b/ext/standard/tests/array/array_chunk_variation26.phpt index 487f6b4f67..ca6975a64e 100644 --- a/ext/standard/tests/array/array_chunk_variation26.phpt +++ b/ext/standard/tests/array/array_chunk_variation26.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 26 <?php $array =array (0); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { [0]=> int(0) } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation27.phpt b/ext/standard/tests/array/array_chunk_variation27.phpt index a83a16b7fb..aa91036a52 100644 --- a/ext/standard/tests/array/array_chunk_variation27.phpt +++ b/ext/standard/tests/array/array_chunk_variation27.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 27 <?php $array = array (1); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { [0]=> int(1) } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation28.phpt b/ext/standard/tests/array/array_chunk_variation28.phpt index bdbaf45cbd..5389049ce4 100644 --- a/ext/standard/tests/array/array_chunk_variation28.phpt +++ b/ext/standard/tests/array/array_chunk_variation28.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 28 <?php $array = array (-1); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { [0]=> int(-1) } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation29.phpt b/ext/standard/tests/array/array_chunk_variation29.phpt index 12f50c1190..f18de5ea85 100644 --- a/ext/standard/tests/array/array_chunk_variation29.phpt +++ b/ext/standard/tests/array/array_chunk_variation29.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 29 <?php $array = array (0, 2); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -19,11 +19,6 @@ array(2) { [1]=> int(2) } -[0] -NULL -NULL -NULL - [1] array(2) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation30.phpt b/ext/standard/tests/array/array_chunk_variation30.phpt index 281537a876..0dbd9b6368 100644 --- a/ext/standard/tests/array/array_chunk_variation30.phpt +++ b/ext/standard/tests/array/array_chunk_variation30.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 30 <?php $array = array (1, 2, 3); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -21,11 +21,6 @@ array(3) { [2]=> int(3) } -[0] -NULL -NULL -NULL - [1] array(3) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation31.phpt b/ext/standard/tests/array/array_chunk_variation31.phpt index 1592679839..fd7f358ca0 100644 --- a/ext/standard/tests/array/array_chunk_variation31.phpt +++ b/ext/standard/tests/array/array_chunk_variation31.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 31 <?php $array = array (1 => 0); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { [1]=> int(0) } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation32.phpt b/ext/standard/tests/array/array_chunk_variation32.phpt index cf65993c0b..09471a59aa 100644 --- a/ext/standard/tests/array/array_chunk_variation32.phpt +++ b/ext/standard/tests/array/array_chunk_variation32.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 32 <?php $array = array (2 => 1); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { [2]=> int(1) } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation5.phpt b/ext/standard/tests/array/array_chunk_variation5.phpt index 50050892e7..21f1a3dce2 100644 --- a/ext/standard/tests/array/array_chunk_variation5.phpt +++ b/ext/standard/tests/array/array_chunk_variation5.phpt @@ -26,26 +26,33 @@ $sizes = array(-1, count($input_array) + 1, 0, 1.5); // loop through the array for size argument foreach ($sizes as $size){ - echo "\n-- Testing array_chunk() when size = $size --\n"; - var_dump( array_chunk($input_array, $size) ); - var_dump( array_chunk($input_array, $size, true) ); - var_dump( array_chunk($input_array, $size, false) ); + echo "\n-- Testing array_chunk() when size = $size --\n"; + try { + var_dump( array_chunk($input_array, $size) ); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } + try { + var_dump( array_chunk($input_array, $size, true) ); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } + try { + var_dump( array_chunk($input_array, $size, false) ); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } } -echo "Done"; ?> ---EXPECTF-- + +DONE +--EXPECT-- *** Testing array_chunk() : usage variations *** -- Testing array_chunk() when size = -1 -- - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL +Size parameter expected to be greater than 0 +Size parameter expected to be greater than 0 +Size parameter expected to be greater than 0 -- Testing array_chunk() when size = 4 -- array(1) { @@ -83,15 +90,9 @@ array(1) { } -- Testing array_chunk() when size = 0 -- - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL +Size parameter expected to be greater than 0 +Size parameter expected to be greater than 0 +Size parameter expected to be greater than 0 -- Testing array_chunk() when size = 1.5 -- array(3) { @@ -145,4 +146,5 @@ array(3) { int(3) } } -Done + +DONE diff --git a/ext/standard/tests/array/array_chunk_variation8.phpt b/ext/standard/tests/array/array_chunk_variation8.phpt index 6a6e752ecb..64b9bb2036 100644 --- a/ext/standard/tests/array/array_chunk_variation8.phpt +++ b/ext/standard/tests/array/array_chunk_variation8.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 8 <?php $array = array (3 => -1); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { [3]=> int(-1) } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation9.phpt b/ext/standard/tests/array/array_chunk_variation9.phpt index ec57da4f88..a68240e6f6 100644 --- a/ext/standard/tests/array/array_chunk_variation9.phpt +++ b/ext/standard/tests/array/array_chunk_variation9.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 9 <?php $array = array (1 => 0, 2 => 2); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -19,11 +19,6 @@ array(2) { [2]=> int(2) } -[0] -NULL -NULL -NULL - [1] array(2) { [0]=> diff --git a/ext/standard/tests/array/array_column_error.phpt b/ext/standard/tests/array/array_column_error.phpt index 26a09aff24..6fb5169d45 100644 --- a/ext/standard/tests/array/array_column_error.phpt +++ b/ext/standard/tests/array/array_column_error.phpt @@ -10,73 +10,51 @@ 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)); +try { + var_dump(array_column(array(), true)); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} + echo "\n-- Testing array_column() column key parameter should be a string or integer (testing array) --\n"; -var_dump(array_column(array(), array())); +try { + var_dump(array_column(array(), array())); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} echo "\n-- Testing array_column() index key parameter should be a string or an integer (testing bool) --\n"; -var_dump(array_column(array(), 'foo', true)); +try { + var_dump(array_column(array(), 'foo', true)); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} echo "\n-- Testing array_column() index key parameter should be a string or integer (testing array) --\n"; -var_dump(array_column(array(), 'foo', array())); +try { + var_dump(array_column(array(), 'foo', array())); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} -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 +DONE +--EXPECT-- +*** Testing array_column() : error conditions *** -- 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 -bool(false) +The column key should be either a string or an integer -- Testing array_column() column key parameter should be a string or integer (testing array) -- - -Warning: array_column(): The column key should be either a string or an integer in %s on line %d -bool(false) +The column key should be either a string or an integer -- Testing array_column() index key parameter should be a string or an integer (testing bool) -- - -Warning: array_column(): The index key should be either a string or an integer in %s on line %d -bool(false) +The index key should be either a string or an integer -- Testing array_column() index key parameter should be a string or integer (testing array) -- +The index key should be either a string or an integer -Warning: array_column(): The index key should be either a string or an integer in %s on line %d -bool(false) -Done +DONE diff --git a/ext/standard/tests/array/array_combine_error2.phpt b/ext/standard/tests/array/array_combine_error2.phpt index 2d820a0d21..463dc6dfe8 100644 --- a/ext/standard/tests/array/array_combine_error2.phpt +++ b/ext/standard/tests/array/array_combine_error2.phpt @@ -16,19 +16,32 @@ var_dump( array_combine(array(), array()) ); // Testing array_combine by passing empty array to $keys echo "\n-- Testing array_combine() function with empty array for \$keys argument --\n"; -var_dump( array_combine(array(), array(1, 2)) ); +try { + var_dump( array_combine(array(), array(1, 2)) ); +} catch (\Error $e) { + echo $e->getMessage(); +} // Testing array_combine by passing empty array to $values echo "\n-- Testing array_combine() function with empty array for \$values argument --\n"; -var_dump( array_combine(array(1, 2), array()) ); +try { + var_dump( array_combine(array(1, 2), array()) ); +} catch (\Error $e) { + echo $e->getMessage(); +} // Testing array_combine with arrays having unequal number of elements echo "\n-- Testing array_combine() function by passing array with unequal number of elements --\n"; -var_dump( array_combine(array(1, 2), array(1, 2, 3)) ); +try { + var_dump( array_combine(array(1, 2), array(1, 2, 3)) ); +} catch (\Error $e) { + echo $e->getMessage(); +} -echo "Done"; ?> ---EXPECTF-- + +DONE +--EXPECT-- *** Testing array_combine() : error conditions specific to array_combine() *** -- Testing array_combine() function with empty arrays -- @@ -36,17 +49,9 @@ array(0) { } -- Testing array_combine() function with empty array for $keys argument -- - -Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d -bool(false) - +Both parameters should have an equal number of elements -- Testing array_combine() function with empty array for $values argument -- - -Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d -bool(false) - +Both parameters should have an equal number of elements -- Testing array_combine() function by passing array with unequal number of elements -- - -Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d -bool(false) -Done +Both parameters should have an equal number of elements +DONE diff --git a/ext/standard/tests/array/array_combine_variation4.phpt b/ext/standard/tests/array/array_combine_variation4.phpt index a7ea0a9dc4..125221cac8 100644 --- a/ext/standard/tests/array/array_combine_variation4.phpt +++ b/ext/standard/tests/array/array_combine_variation4.phpt @@ -60,10 +60,10 @@ $arrays = array ( array("hello", $heredoc => "string"), // heredoc // array with object, unset variable and resource variable -/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), +/*10*/ array(@$unset_var => "hello", $fp => 'resource'), // array with mixed keys -/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, +/*11*/ array('hello' => 1, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); @@ -71,7 +71,7 @@ $arrays = array ( // array to be passsed to $arr2 argument $arr2 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4", "\tHello" => 111, 2.2, 'color', "Hello world" => "string", - "pen\n" => 33, new classA() => 11, 133 => "int"); + "pen\n" => 33, 133 => "int"); // loop through each sub-array within $arrays to check the behavior of array_combine() // same arrays are passed to both $keys and $values @@ -90,15 +90,9 @@ echo "Done"; --EXPECTF-- *** Testing array_combine() : assoc array with diff keys to both $keys and $values argument *** -Warning: Illegal offset type in %s on line %d - Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d -Warning: Illegal offset type in %s on line %d - Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d - -Warning: Illegal offset type in %s on line %d -- Iteration 1 -- array(0) { } diff --git a/ext/standard/tests/array/array_count_values2.phpt b/ext/standard/tests/array/array_count_values2.phpt index 8aaf445f93..cb0c330965 100644 --- a/ext/standard/tests/array/array_count_values2.phpt +++ b/ext/standard/tests/array/array_count_values2.phpt @@ -18,11 +18,11 @@ $array1 = array(1, var_dump(array_count_values($array1)); ?> --EXPECTF-- -Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %d +Warning: array_count_values(): Can only count string and integer values, entry skipped in %s on line %d -Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %d +Warning: array_count_values(): Can only count string and integer values, entry skipped in %s on line %d -Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %d +Warning: array_count_values(): Can only count string and integer values, entry skipped in %s on line %d array(8) { [1]=> int(2) diff --git a/ext/standard/tests/array/array_diff_1.phpt b/ext/standard/tests/array/array_diff_1.phpt index a7ee015346..2e2b135128 100644 --- a/ext/standard/tests/array/array_diff_1.phpt +++ b/ext/standard/tests/array/array_diff_1.phpt @@ -6,10 +6,14 @@ Test array_diff when non-array is passed $a = array(); $b = 3; $c = array(5); -array_diff($a, $b, $c); +try { + array_diff($a, $b, $c); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //-=-=-=-=-=- echo "OK!"; ?> --EXPECTF-- -Warning: array_diff(): Expected parameter 2 to be an array, int given in %s +Expected parameter 2 to be an array, int given OK! diff --git a/ext/standard/tests/array/array_diff_assoc_error.phpt b/ext/standard/tests/array/array_diff_assoc_error.phpt index fc8c70c67c..6aa7864ee9 100644 --- a/ext/standard/tests/array/array_diff_assoc_error.phpt +++ b/ext/standard/tests/array/array_diff_assoc_error.phpt @@ -16,13 +16,20 @@ echo "*** Testing array_diff_assoc() : error conditions ***\n"; // Zero arguments echo "\n-- Testing array_diff_assoc() function with zero arguments --\n"; -var_dump( array_diff_assoc() ); +try { + var_dump( array_diff_assoc() ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_diff_assoc with one less than the expected number of arguments echo "\n-- Testing array_diff_assoc() function with less than expected no. of arguments --\n"; $arr1 = array(1, 2); -var_dump( array_diff_assoc($arr1) ); - +try { + var_dump( array_diff_assoc($arr1) ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -30,12 +37,8 @@ echo "Done"; *** Testing array_diff_assoc() : error conditions *** -- Testing array_diff_assoc() function with zero arguments -- - -Warning: array_diff_assoc(): at least 2 parameters are required, 0 given in %s on line %d -NULL +At least 2 parameters are required, 0 given -- Testing array_diff_assoc() function with less than expected no. of arguments -- - -Warning: array_diff_assoc(): at least 2 parameters are required, 1 given in %s on line %d -NULL +At least 2 parameters are required, 1 given Done diff --git a/ext/standard/tests/array/array_diff_assoc_variation1.phpt b/ext/standard/tests/array/array_diff_assoc_variation1.phpt index 2172e695d3..270660a8cf 100644 --- a/ext/standard/tests/array/array_diff_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_diff_assoc_variation1.phpt @@ -91,143 +91,95 @@ $inputs = array( // loop through each element of $inputs to check the behavior of array_diff_assoc $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_diff_assoc($input, $array)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + try { + var_dump(array_diff_assoc($input, $array)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_diff_assoc() : usage variations *** -- Iteration 1 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given -- Iteration 2 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given -- Iteration 3 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given -- Iteration 4 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given -- Iteration 5 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given -- Iteration 6 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given -- Iteration 7 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given -- Iteration 8 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given -- Iteration 9 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given -- Iteration 10 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given -- Iteration 11 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given -- Iteration 12 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given -- Iteration 13 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given -- Iteration 14 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given -- Iteration 15 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given -- Iteration 16 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given -- Iteration 17 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given -- Iteration 18 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given -- Iteration 19 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given -- Iteration 20 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given -- Iteration 21 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given -- Iteration 22 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given -- Iteration 23 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given -- Iteration 24 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given -- Iteration 25 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given -- Iteration 26 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +Expected parameter 1 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_diff_assoc_variation2.phpt b/ext/standard/tests/array/array_diff_assoc_variation2.phpt index a57f10fce0..9185b53439 100644 --- a/ext/standard/tests/array/array_diff_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_diff_assoc_variation2.phpt @@ -91,143 +91,95 @@ $inputs = array( // loop through each element of $inputs to check the behavior of array_diff_assoc $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_diff_assoc($array, $input)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + try { + var_dump(array_diff_assoc($array, $input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_diff_assoc() : usage variations *** -- Iteration 1 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 2 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 3 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 4 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 5 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 6 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 7 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 8 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 9 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 10 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 11 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 12 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 13 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 14 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 15 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 16 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 17 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 18 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 19 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 20 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 21 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 22 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 23 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given -- Iteration 24 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 25 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 26 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_diff_error.phpt b/ext/standard/tests/array/array_diff_error.phpt index 25be6e1c55..d269f010b8 100644 --- a/ext/standard/tests/array/array_diff_error.phpt +++ b/ext/standard/tests/array/array_diff_error.phpt @@ -15,13 +15,21 @@ Test array_diff() function : error conditions - too few arguments passed to func echo "*** Testing array_diff() : error conditions ***\n"; // Zero arguments echo "\n-- Testing array_diff() function with zero arguments --\n"; -var_dump( array_diff() ); +try { + var_dump( array_diff() ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_diff with one less than the expected number of arguments echo "\n-- Testing array_diff() function with less than expected no. of arguments --\n"; $arr1 = array(1, 2); -var_dump( array_diff($arr1) ); +try { + var_dump( array_diff($arr1) ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -29,12 +37,8 @@ echo "Done"; *** Testing array_diff() : error conditions *** -- Testing array_diff() function with zero arguments -- - -Warning: array_diff(): at least 2 parameters are required, 0 given in %s on line %d -NULL +At least 2 parameters are required, 0 given -- Testing array_diff() function with less than expected no. of arguments -- - -Warning: array_diff(): at least 2 parameters are required, 1 given in %s on line %d -NULL +At least 2 parameters are required, 1 given Done diff --git a/ext/standard/tests/array/array_diff_key_error.phpt b/ext/standard/tests/array/array_diff_key_error.phpt index 05d5cf3c27..ec5ef10ba8 100644 --- a/ext/standard/tests/array/array_diff_key_error.phpt +++ b/ext/standard/tests/array/array_diff_key_error.phpt @@ -14,23 +14,27 @@ $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); // Testing array_diff_key with one less than the expected number of arguments echo "\n-- Testing array_diff_key() function with less than expected no. of arguments --\n"; -var_dump( array_diff_key($array1) ); +try { + var_dump( array_diff_key($array1) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_diff_key with no arguments echo "\n-- Testing array_diff_key() function with no arguments --\n"; -var_dump( array_diff_key() ); +try { + var_dump( array_diff_key() ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== --EXPECTF-- *** Testing array_diff_key() : error conditions *** -- Testing array_diff_key() function with less than expected no. of arguments -- - -Warning: array_diff_key(): at least 2 parameters are required, 1 given in %s on line %d -NULL +At least 2 parameters are required, 1 given -- Testing array_diff_key() function with no arguments -- - -Warning: array_diff_key(): at least 2 parameters are required, 0 given in %s on line %d -NULL +At least 2 parameters are required, 0 given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_key_variation1.phpt b/ext/standard/tests/array/array_diff_key_variation1.phpt index 3e689a0e8f..f47042f009 100644 --- a/ext/standard/tests/array/array_diff_key_variation1.phpt +++ b/ext/standard/tests/array/array_diff_key_variation1.phpt @@ -89,222 +89,126 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_key($value, $array2) ); - var_dump( array_diff_key($value, $array2, $array3) ); + echo "\n--$key--\n"; + try { + var_dump( array_diff_key($value, $array2) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_diff_key($value, $array2, $array3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_key() : usage variation *** --int 0-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --resource-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +Expected parameter 1 to be an array, resource given +Expected parameter 1 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_key_variation2.phpt b/ext/standard/tests/array/array_diff_key_variation2.phpt index fb0bcd6796..24ddffb530 100644 --- a/ext/standard/tests/array/array_diff_key_variation2.phpt +++ b/ext/standard/tests/array/array_diff_key_variation2.phpt @@ -90,222 +90,126 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_key($array1, $value) ); - var_dump( array_diff_key($array1, $value, $array3) ); + echo "\n--$key--\n"; + try { + var_dump( array_diff_key($array1, $value) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_diff_key($array1, $value, $array3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_key() : usage variation *** --int 0-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --resource-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given +Expected parameter 2 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_key_variation3.phpt b/ext/standard/tests/array/array_diff_key_variation3.phpt deleted file mode 100644 index 36741dba33..0000000000 --- a/ext/standard/tests/array/array_diff_key_variation3.phpt +++ /dev/null @@ -1,232 +0,0 @@ ---TEST-- -Test array_diff_key() function : usage variation - Passing unexpected values to third optional argument ---FILE-- -<?php -/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...]) - * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments. - * Source code: ext/standard/array.c - */ - -echo "*** Testing array_diff_key() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); -$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//resource variable -$fp = fopen(__FILE__, "r"); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource data - 'resource' => $fp, -); - -// loop through each element of the array for arr1 - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_key($array1, $array2, $value) ); -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing array_diff_key() : usage variation *** - ---int 0-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 1-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 12345-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int -12345-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---float 10.5-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -10.5-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float .5-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---uppercase NULL-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase null-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase true-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---lowercase false-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase TRUE-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase FALSE-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---empty string DQ-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string DQ-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string SQ-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---heredoc-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---undefined var-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---unset var-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---resource-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_error.phpt b/ext/standard/tests/array/array_diff_uassoc_error.phpt index d90c80f20b..13881f6993 100644 --- a/ext/standard/tests/array/array_diff_uassoc_error.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_error.phpt @@ -27,36 +27,34 @@ 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) ); +try { + var_dump( array_diff_uassoc($array1, $array2) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -// 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-- +--EXPECT-- *** 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 +At least 3 parameters are required, 2 given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation1.phpt b/ext/standard/tests/array/array_diff_uassoc_variation1.phpt index aad42705db..03f3160a00 100644 --- a/ext/standard/tests/array/array_diff_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_variation1.phpt @@ -102,143 +102,95 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_uassoc($value, $array2, "key_compare_func") ); + echo "\n--$key--\n"; + try { + var_dump( array_diff_uassoc($value, $array2, "key_compare_func") ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_uassoc() : usage variation *** --int 0-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given --resource-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +Expected parameter 1 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation2.phpt b/ext/standard/tests/array/array_diff_uassoc_variation2.phpt index ae664f9812..7ca05b1fd0 100644 --- a/ext/standard/tests/array/array_diff_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_variation2.phpt @@ -102,143 +102,95 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_uassoc($array1, $value, "key_compare_func") ); + echo "\n--$key--\n"; + try { + var_dump( array_diff_uassoc($array1, $value, "key_compare_func") ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_uassoc() : usage variation *** --int 0-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given --resource-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation4.phpt b/ext/standard/tests/array/array_diff_uassoc_variation4.phpt deleted file mode 100644 index 8ea51a4103..0000000000 --- a/ext/standard/tests/array/array_diff_uassoc_variation4.phpt +++ /dev/null @@ -1,246 +0,0 @@ ---TEST-- -Test array_diff_uassoc() function : usage variation -Passing unexpected values as third optional argument ---FILE-- -<?php -/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func) - * Description: Computes the difference of arrays with additional index check which is performed by a - * user supplied callback function - * Source code: ext/standard/array.c - */ - -echo "*** Testing array_diff_uassoc() : usage variation ***\n"; - -//Initialize variables -$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); -$array2 = array("a" => "green", "yellow", "red"); - - -function key_compare_func($a, $b) -{ - if ($a === $b) { - return 0; - } - return ($a > $b)? 1:-1; -} - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//resource variable -$fp = fopen(__FILE__, "r"); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource data - 'resource' => $fp, -); - -// loop through each element of the array for arr2 - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_uassoc($array1, $array2, $value, "key_compare_func") ); -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing array_diff_uassoc() : usage variation *** - ---int 0-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 1-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 12345-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int -12345-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---float 10.5-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -10.5-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float .5-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---uppercase NULL-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase null-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase true-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---lowercase false-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase TRUE-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase FALSE-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---empty string DQ-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string DQ-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string SQ-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---heredoc-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---undefined var-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---unset var-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---resource-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation1.phpt b/ext/standard/tests/array/array_diff_ukey_variation1.phpt index bbf349c4fd..3b591018bd 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation1.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation1.phpt @@ -97,222 +97,126 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_ukey($value, $array2, 'key_compare_func') ); - var_dump( array_diff_ukey($value, $array2, $array3, 'key_compare_func') ); + echo "\n--$key--\n"; + try { + var_dump( array_diff_ukey($value, $array2, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_diff_ukey($value, $array2, $array3, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_ukey() : usage variation *** --int 0-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --resource-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +Expected parameter 1 to be an array, resource given +Expected parameter 1 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation10.phpt b/ext/standard/tests/array/array_diff_ukey_variation10.phpt index 09b4a70237..e80f02629e 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation10.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation10.phpt @@ -14,27 +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') ); - -//function name without 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 - -Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d - -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_diff_ukey_variation2.phpt b/ext/standard/tests/array/array_diff_ukey_variation2.phpt index 38141a430c..3638afcb53 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation2.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation2.phpt @@ -101,222 +101,126 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_ukey($array1, $value, 'key_compare_func') ); - var_dump( array_diff_ukey($array1, $value, $array3, 'key_compare_func') ); + echo "\n--$key--\n"; + try { + var_dump( array_diff_ukey($array1, $value, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_diff_ukey($array1, $value, $array3, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_ukey() : usage variation *** --int 0-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --resource-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given +Expected parameter 2 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation3.phpt b/ext/standard/tests/array/array_diff_ukey_variation3.phpt deleted file mode 100644 index 572061d697..0000000000 --- a/ext/standard/tests/array/array_diff_ukey_variation3.phpt +++ /dev/null @@ -1,240 +0,0 @@ ---TEST-- -Test array_diff_ukey() function : usage variation - Passing unexpected values to third optional argument ---FILE-- -<?php -/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func) - * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments. - * Source code: ext/standard/array.c - */ - -echo "*** Testing array_diff_ukey() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$array1 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); -$array2 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); - -function key_compare_func($key1, $key2) -{ - if ($key1 == $key2) { - return 0; - } - return ($key1 > $key2)? 1:-1; -} - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// resource variable -$fp = fopen(__FILE__, "r"); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource data - 'resource' => $fp, -); - -// loop through each element of the array for key_comp_func - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_ukey($array1, $array2, $value, 'key_compare_func') ); -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing array_diff_ukey() : usage variation *** - ---int 0-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 1-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 12345-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int -12345-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---float 10.5-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -10.5-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float .5-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---uppercase NULL-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase null-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase true-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---lowercase false-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase TRUE-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase FALSE-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---empty string DQ-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string DQ-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string SQ-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---heredoc-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---undefined var-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---unset var-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---resource-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_diff_variation1.phpt b/ext/standard/tests/array/array_diff_variation1.phpt index e162c523d6..5b92231642 100644 --- a/ext/standard/tests/array/array_diff_variation1.phpt +++ b/ext/standard/tests/array/array_diff_variation1.phpt @@ -91,118 +91,70 @@ $inputs = array( // loop through each element of $inputs to check the behavior of array_diff $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --"; - var_dump( array_diff($input, $array)); - $iterator++; + echo "\n-- Iteration $iterator --"; + try { + var_dump( array_diff($input, $array)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_diff() : usage variations *** --- Iteration 1 -- -Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- Iteration 1 --Expected parameter 1 to be an array, int given --- Iteration 2 -- -Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- Iteration 2 --Expected parameter 1 to be an array, int given --- Iteration 3 -- -Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- Iteration 3 --Expected parameter 1 to be an array, int given --- Iteration 4 -- -Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- Iteration 4 --Expected parameter 1 to be an array, int given --- Iteration 5 -- -Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- Iteration 5 --Expected parameter 1 to be an array, float given --- Iteration 6 -- -Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- Iteration 6 --Expected parameter 1 to be an array, float given --- Iteration 7 -- -Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- Iteration 7 --Expected parameter 1 to be an array, float given --- Iteration 8 -- -Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- Iteration 8 --Expected parameter 1 to be an array, float given --- Iteration 9 -- -Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- Iteration 9 --Expected parameter 1 to be an array, float given --- Iteration 10 -- -Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 10 --Expected parameter 1 to be an array, null given --- Iteration 11 -- -Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 11 --Expected parameter 1 to be an array, null given --- Iteration 12 -- -Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 12 --Expected parameter 1 to be an array, bool given --- Iteration 13 -- -Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 13 --Expected parameter 1 to be an array, bool given --- Iteration 14 -- -Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 14 --Expected parameter 1 to be an array, bool given --- Iteration 15 -- -Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 15 --Expected parameter 1 to be an array, bool given --- Iteration 16 -- -Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 16 --Expected parameter 1 to be an array, string given --- Iteration 17 -- -Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 17 --Expected parameter 1 to be an array, string given --- Iteration 18 -- -Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 18 --Expected parameter 1 to be an array, string given --- Iteration 19 -- -Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 19 --Expected parameter 1 to be an array, string given --- Iteration 20 -- -Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 20 --Expected parameter 1 to be an array, string given --- Iteration 21 -- -Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 21 --Expected parameter 1 to be an array, string given --- Iteration 22 -- -Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 22 --Expected parameter 1 to be an array, string given --- Iteration 23 -- -Warning: array_diff(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +-- Iteration 23 --Expected parameter 1 to be an array, object given --- Iteration 24 -- -Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 24 --Expected parameter 1 to be an array, null given --- Iteration 25 -- -Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 25 --Expected parameter 1 to be an array, null given --- Iteration 26 -- -Warning: array_diff(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +-- Iteration 26 --Expected parameter 1 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_diff_variation2.phpt b/ext/standard/tests/array/array_diff_variation2.phpt index 5f8183b88d..a9ddb22b82 100644 --- a/ext/standard/tests/array/array_diff_variation2.phpt +++ b/ext/standard/tests/array/array_diff_variation2.phpt @@ -91,117 +91,69 @@ $inputs = array( // loop through each element of $inputs to check the behavior of array_diff $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --"; - var_dump( array_diff($array, $input)); - $iterator++; + echo "\n-- Iteration $iterator --"; + try { + var_dump( array_diff($array, $input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_diff() : usage variations *** --- Iteration 1 -- -Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 1 --Expected parameter 2 to be an array, int given --- Iteration 2 -- -Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 2 --Expected parameter 2 to be an array, int given --- Iteration 3 -- -Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 3 --Expected parameter 2 to be an array, int given --- Iteration 4 -- -Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 4 --Expected parameter 2 to be an array, int given --- Iteration 5 -- -Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 5 --Expected parameter 2 to be an array, float given --- Iteration 6 -- -Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 6 --Expected parameter 2 to be an array, float given --- Iteration 7 -- -Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 7 --Expected parameter 2 to be an array, float given --- Iteration 8 -- -Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 8 --Expected parameter 2 to be an array, float given --- Iteration 9 -- -Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 9 --Expected parameter 2 to be an array, float given --- Iteration 10 -- -Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 10 --Expected parameter 2 to be an array, null given --- Iteration 11 -- -Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 11 --Expected parameter 2 to be an array, null given --- Iteration 12 -- -Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 12 --Expected parameter 2 to be an array, bool given --- Iteration 13 -- -Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 13 --Expected parameter 2 to be an array, bool given --- Iteration 14 -- -Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 14 --Expected parameter 2 to be an array, bool given --- Iteration 15 -- -Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 15 --Expected parameter 2 to be an array, bool given --- Iteration 16 -- -Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 16 --Expected parameter 2 to be an array, string given --- Iteration 17 -- -Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 17 --Expected parameter 2 to be an array, string given --- Iteration 18 -- -Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 18 --Expected parameter 2 to be an array, string given --- Iteration 19 -- -Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 19 --Expected parameter 2 to be an array, string given --- Iteration 20 -- -Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 20 --Expected parameter 2 to be an array, string given --- Iteration 21 -- -Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 21 --Expected parameter 2 to be an array, string given --- Iteration 22 -- -Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 22 --Expected parameter 2 to be an array, string given --- Iteration 23 -- -Warning: array_diff(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +-- Iteration 23 --Expected parameter 2 to be an array, object given --- Iteration 24 -- -Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 24 --Expected parameter 2 to be an array, null given --- Iteration 25 -- -Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 25 --Expected parameter 2 to be an array, null given --- Iteration 26 -- -Warning: array_diff(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +-- Iteration 26 --Expected parameter 2 to be an array, resource given 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 a6f5789eae..240f5c10fa 100644 --- a/ext/standard/tests/array/array_filter_variation9.phpt +++ b/ext/standard/tests/array/array_filter_variation9.phpt @@ -13,7 +13,7 @@ Test array_filter() function : usage variations - built-in functions as 'callbac echo "*** Testing array_filter() : usage variations - built-in functions as 'callback' argument ***\n"; -$input = array(0, 1, -1, 10, 100, 1000, 'Hello', null); +$input = array(0, 1, -1, 10, 100, 1000, null); // using built-in function 'is_int' as 'callback' var_dump( array_filter($input, 'is_int') ); @@ -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" ?> @@ -45,9 +53,7 @@ array(6) { [5]=> int(1000) } - -Warning: chr() expects parameter 1 to be int, string given in %s on line %d -array(8) { +array(7) { [0]=> int(0) [1]=> @@ -61,14 +67,8 @@ array(8) { [5]=> int(1000) [6]=> - string(5) "Hello" - [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_flip.phpt b/ext/standard/tests/array/array_flip.phpt index ab8cf271b1..b03c65f034 100644 --- a/ext/standard/tests/array/array_flip.phpt +++ b/ext/standard/tests/array/array_flip.phpt @@ -16,11 +16,11 @@ $trans = array_flip($trans); var_dump($trans); ?> --EXPECTF-- -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d array(6) { [1]=> string(1) "b" diff --git a/ext/standard/tests/array/array_flip_variation4.phpt b/ext/standard/tests/array/array_flip_variation4.phpt index b8badb0caa..0ad2367701 100644 --- a/ext/standard/tests/array/array_flip_variation4.phpt +++ b/ext/standard/tests/array/array_flip_variation4.phpt @@ -62,29 +62,29 @@ echo "Done" --EXPECTF-- *** Testing array_flip() : different invalid values in 'input' array argument *** -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d -Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d +Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d array(0) { } Done diff --git a/ext/standard/tests/array/array_intersect_assoc_error.phpt b/ext/standard/tests/array/array_intersect_assoc_error.phpt index a06dbddefe..fa815118ce 100644 --- a/ext/standard/tests/array/array_intersect_assoc_error.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_error.phpt @@ -12,25 +12,29 @@ echo "*** Testing array_intersect_assoc() : error conditions ***\n"; // Zero arguments echo "\n-- Testing array_intersect_assoc() function with Zero arguments --\n"; -var_dump( array_intersect_assoc() ); +try { + var_dump( array_intersect_assoc() ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_intersect_assoc with one less than the expected number of arguments echo "\n-- Testing array_intersect_assoc() function with less than expected no. of arguments --\n"; $arr1 = array(1, 2); -var_dump( array_intersect_assoc($arr1) ); +try { + var_dump( array_intersect_assoc($arr1) ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_assoc() : error conditions *** -- Testing array_intersect_assoc() function with Zero arguments -- - -Warning: array_intersect_assoc(): at least 2 parameters are required, 0 given in %s on line %d -NULL +At least 2 parameters are required, 0 given -- Testing array_intersect_assoc() function with less than expected no. of arguments -- - -Warning: array_intersect_assoc(): at least 2 parameters are required, 1 given in %s on line %d -NULL +At least 2 parameters are required, 1 given Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation1.phpt b/ext/standard/tests/array/array_intersect_assoc_variation1.phpt index ca11b7cc9b..3490c4f25c 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation1.phpt @@ -93,14 +93,22 @@ $arrays = array( // loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc() $iterator = 1; foreach($arrays as $unexpected_value) { - echo "\n-- Iteration $iterator --"; - - // Calling array_intersect_assoc() with default arguments - var_dump( array_intersect_assoc($unexpected_value, $arr2) ); - - // Calling array_intersect_assoc() with more arguments - var_dump( array_intersect_assoc($unexpected_value, $arr2, $arr3) ); - $iterator++; + echo "\n-- Iteration $iterator --"; + + // Calling array_intersect_assoc() with default arguments + try { + var_dump( array_intersect_assoc($unexpected_value, $arr2) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + // Calling array_intersect_assoc() with more arguments + try { + var_dump( array_intersect_assoc($unexpected_value, $arr2, $arr3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; } // close the file resource used @@ -108,174 +116,78 @@ fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_assoc() : Passing non-array values to $arr1 argument *** --- Iteration 1 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 2 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 3 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 4 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 5 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 6 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 7 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 8 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 9 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 10 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iteration 11 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iteration 12 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - --- Iteration 13 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 1 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 2 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --- Iteration 14 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 3 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 4 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --- Iteration 15 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 5 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 6 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --- Iteration 16 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 7 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 8 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --- Iteration 17 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 9 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 10 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --- Iteration 18 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 11 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 12 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --- Iteration 19 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 13 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 14 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --- Iteration 20 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 15 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 16 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --- Iteration 21 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +-- Iteration 17 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +-- Iteration 18 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --- Iteration 22 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 19 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 20 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --- Iteration 23 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 21 --Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 22 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --- Iteration 24 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +-- Iteration 23 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +-- Iteration 24 --Expected parameter 1 to be an array, resource given +Expected parameter 1 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation2.phpt b/ext/standard/tests/array/array_intersect_assoc_variation2.phpt index 274da6f7b2..12cf4d7307 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation2.phpt @@ -93,15 +93,23 @@ $arrays = array( // loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc() $iterator = 1; foreach($arrays as $unexpected_value) { - echo "\n-- Iteration $iterator --"; - - // Calling array_intersect_assoc() with default arguments - var_dump( array_intersect_assoc($arr1,$unexpected_value) ); - - // Calling array_intersect_assoc() with more arguments - var_dump( array_intersect_assoc($arr1, $unexpected_value, $arr3) ); - - $iterator++; + echo "\n-- Iteration $iterator --"; + + // Calling array_intersect_assoc() with default arguments + try { + var_dump( array_intersect_assoc($arr1,$unexpected_value) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + // Calling array_intersect_assoc() with more arguments + try { + var_dump( array_intersect_assoc($arr1, $unexpected_value, $arr3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + $iterator++; } // close the file resource used @@ -109,174 +117,78 @@ fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_assoc() : Passing non-array values to $arr2 argument *** --- Iteration 1 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iteration 2 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iteration 3 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iteration 4 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iteration 5 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iteration 6 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iteration 7 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iteration 8 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iteration 9 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iteration 10 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - --- Iteration 11 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - --- Iteration 12 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - --- Iteration 13 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 1 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 2 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --- Iteration 14 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 3 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 4 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --- Iteration 15 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 5 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 6 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --- Iteration 16 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 7 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 8 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --- Iteration 17 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 9 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 10 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --- Iteration 18 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 11 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 12 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --- Iteration 19 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 13 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 14 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --- Iteration 20 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 15 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 16 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --- Iteration 21 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +-- Iteration 17 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +-- Iteration 18 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --- Iteration 22 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 19 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 20 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --- Iteration 23 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 21 --Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 22 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --- Iteration 24 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +-- Iteration 23 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +-- Iteration 24 --Expected parameter 2 to be an array, resource given +Expected parameter 2 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_intersect_error.phpt b/ext/standard/tests/array/array_intersect_error.phpt index 373a0ddbe0..81be2634db 100644 --- a/ext/standard/tests/array/array_intersect_error.phpt +++ b/ext/standard/tests/array/array_intersect_error.phpt @@ -11,25 +11,29 @@ echo "*** Testing array_intersect() : error conditions ***\n"; // Testing array_intersect() with zero arguments echo "\n-- Testing array_intersect() function with Zero arguments --\n"; -var_dump( array_intersect() ); +try { + var_dump( array_intersect() ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_intersect() with one less than the expected number of arguments echo "\n-- Testing array_intersect() function with less than expected no. of arguments --\n"; $arr1 = array(1, 2); -var_dump( array_intersect($arr1) ); +try { + var_dump( array_intersect($arr1) ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_intersect() : error conditions *** -- Testing array_intersect() function with Zero arguments -- - -Warning: array_intersect(): at least 2 parameters are required, 0 given in %s on line %d -NULL +At least 2 parameters are required, 0 given -- Testing array_intersect() function with less than expected no. of arguments -- - -Warning: array_intersect(): at least 2 parameters are required, 1 given in %s on line %d -NULL +At least 2 parameters are required, 1 given Done diff --git a/ext/standard/tests/array/array_intersect_key_error.phpt b/ext/standard/tests/array/array_intersect_key_error.phpt index 10ad8ad342..7db4b7415f 100644 --- a/ext/standard/tests/array/array_intersect_key_error.phpt +++ b/ext/standard/tests/array/array_intersect_key_error.phpt @@ -14,23 +14,27 @@ $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); // Testing array_intersect_key with one less than the expected number of arguments echo "\n-- Testing array_intersect_key() function with less than expected no. of arguments --\n"; -var_dump( array_intersect_key($array1) ); +try { + var_dump( array_intersect_key($array1) ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_intersect_key with one less than the expected number of arguments echo "\n-- Testing array_intersect_key() function with no arguments --\n"; -var_dump( array_intersect_key() ); +try { + var_dump( array_intersect_key() ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_key() : error conditions *** -- Testing array_intersect_key() function with less than expected no. of arguments -- - -Warning: array_intersect_key(): at least 2 parameters are required, 1 given in %s on line %d -NULL +At least 2 parameters are required, 1 given -- Testing array_intersect_key() function with no arguments -- - -Warning: array_intersect_key(): at least 2 parameters are required, 0 given in %s on line %d -NULL +At least 2 parameters are required, 0 given ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_key_variation1.phpt b/ext/standard/tests/array/array_intersect_key_variation1.phpt index fb9dd2c7aa..0987205b7e 100644 --- a/ext/standard/tests/array/array_intersect_key_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_key_variation1.phpt @@ -93,222 +93,126 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_key($value, $array2) ); - var_dump( array_intersect_key($value, $array2, $array3) ); + echo "\n--$key--\n"; + try { + var_dump( array_intersect_key($value, $array2) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_intersect_key($value, $array2, $array3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_key() : usage variation *** --int 0-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --resource var-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +Expected parameter 1 to be an array, resource given +Expected parameter 1 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_key_variation2.phpt b/ext/standard/tests/array/array_intersect_key_variation2.phpt index 5d2147b99f..8d46b6efae 100644 --- a/ext/standard/tests/array/array_intersect_key_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_key_variation2.phpt @@ -94,222 +94,126 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_key($array1, $value) ); - var_dump( array_intersect_key($array1, $value, $array3) ); + echo "\n--$key--\n"; + try { + var_dump( array_intersect_key($array1, $value) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_intersect_key($array1, $value, $array3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_key() : usage variation *** --int 0-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --resource var-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given +Expected parameter 2 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_key_variation3.phpt b/ext/standard/tests/array/array_intersect_key_variation3.phpt deleted file mode 100644 index dca52bafc2..0000000000 --- a/ext/standard/tests/array/array_intersect_key_variation3.phpt +++ /dev/null @@ -1,235 +0,0 @@ ---TEST-- -Test array_intersect_key() function : usage variation - Passing unexpected values to optional argument ---FILE-- -<?php -/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...]) - * Description: Returns the entries of arr1 that have keys which are present in all the other arguments. - * Source code: ext/standard/array.c - */ - -echo "*** Testing array_intersect_key() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); -$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//resource variable -$fp = fopen(__FILE__, "r"); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource data - 'resource var' => $fp, -); - -// loop through each element of the array for arr2 -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_key($array1, $array2, $value) ); -} - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing array_intersect_key() : usage variation *** - ---int 0-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 1-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 12345-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int -12345-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---float 10.5-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -10.5-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float .5-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---uppercase NULL-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase null-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase true-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---lowercase false-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase TRUE-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase FALSE-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---empty string DQ-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string DQ-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string SQ-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---heredoc-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---undefined var-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---unset var-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---resource var-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt index 887ad12d9a..4c4a69250c 100644 --- a/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt @@ -101,222 +101,126 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_uassoc($value, $array2, 'key_compare_func') ); - var_dump( array_intersect_uassoc($value, $array2, $array3, 'key_compare_func') ); + echo "\n--$key--\n"; + try { + var_dump( array_intersect_uassoc($value, $array2, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_intersect_uassoc($value, $array2, $array3, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_uassoc() : usage variation *** --int 0-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --resource-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +Expected parameter 1 to be an array, resource given +Expected parameter 1 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt index d482e9ffcc..0daa424314 100644 --- a/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt @@ -101,222 +101,126 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_uassoc($array1, $value, 'key_compare_func') ); - var_dump( array_intersect_uassoc($array1, $value, $array3, 'key_compare_func') ); + echo "\n--$key--\n"; + try { + var_dump( array_intersect_uassoc($array1, $value, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_intersect_uassoc($array1, $value, $array3, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_uassoc() : usage variation *** --int 0-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --resource-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given +Expected parameter 2 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt deleted file mode 100644 index 42e53101dc..0000000000 --- a/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt +++ /dev/null @@ -1,243 +0,0 @@ ---TEST-- -Test array_intersect_uassoc() function : usage variation - Passing unexpected values to optional third argument ---FILE-- -<?php -/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func) - * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function - * Source code: ext/standard/array.c - */ - -echo "*** Testing array_intersect_uassoc() : usage variation ***\n"; - -// Initialise function arguments -$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); -$array2 = array("a" => "green", "yellow", "red"); - -//Callback function -function key_compare_func($a, $b) { - if ($a === $b) { - return 0; - } - return ($a > $b) ? 1 : -1; -} - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//resource variable -$fp = fopen(__FILE__, "r"); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource data - 'resource' => $fp, -); - -// loop through each element of the array for arr1 -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_uassoc($array1, $array2, $value, 'key_compare_func') ); -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing array_intersect_uassoc() : usage variation *** - ---int 0-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 1-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 12345-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int -12345-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---float 10.5-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -10.5-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float .5-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---uppercase NULL-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase null-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase true-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---lowercase false-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase TRUE-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase FALSE-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---empty string DQ-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string DQ-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string SQ-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---heredoc-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---undefined var-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---unset var-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---resource-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_intersect_ukey_variation1.phpt b/ext/standard/tests/array/array_intersect_ukey_variation1.phpt index 86850094b8..cf1525a519 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation1.phpt @@ -99,222 +99,126 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_ukey($value, $array2, 'key_compare_func') ); - var_dump( array_intersect_ukey($value, $array2, $array3, 'key_compare_func') ); + echo "\n--$key--\n"; + try { + var_dump( array_intersect_ukey($value, $array2, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_intersect_ukey($value, $array2, $array3, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_ukey() : usage variation *** --int 0-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --resource var-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +Expected parameter 1 to be an array, resource given +Expected parameter 1 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt index 82b43628e3..f4df546f8e 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt @@ -99,222 +99,126 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_ukey($array1, $value, 'key_compare_func') ); - var_dump( array_intersect_ukey($array1, $value, $array3, 'key_compare_func') ); + echo "\n--$key--\n"; + try { + var_dump( array_intersect_ukey($array1, $value, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_intersect_ukey($array1, $value, $array3, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_ukey() : usage variation *** --int 0-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --resource var-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given +Expected parameter 2 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_ukey_variation4.phpt b/ext/standard/tests/array/array_intersect_ukey_variation4.phpt deleted file mode 100644 index 35c0d4a2e6..0000000000 --- a/ext/standard/tests/array/array_intersect_ukey_variation4.phpt +++ /dev/null @@ -1,321 +0,0 @@ ---TEST-- -Test array_intersect_ukey() function : usage variation - Passing unexpected values to optional third argument ---FILE-- -<?php -/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func) - * Description: Computes the intersection of arrays using a callback function on the keys for comparison. - * Source code: ext/standard/array.c - */ - -echo "*** Testing array_intersect_ukey() : usage variation ***\n"; - -//Initialise arguments -$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); -$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); -$array4 = array('green' => 5, 'cyan' => 8); - -//Call back function -function key_compare_func($key1, $key2) -{ - if ($key1 == $key2) - return 0; - else - return ($key1 > $key2)? 1:-1; -} - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//resource variable -$fp = fopen(__FILE__, "r"); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource data - 'resource var' => $fp, -); - -// loop through each element of the array for arr2 - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_ukey($array1, $array2, $value, 'key_compare_func') ); - var_dump( array_intersect_ukey($array1, $array2, $value, $array4, 'key_compare_func') ); -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing array_intersect_ukey() : usage variation *** - ---int 0-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 1-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 12345-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int -12345-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---float 10.5-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -10.5-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float .5-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---uppercase NULL-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase null-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase true-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---lowercase false-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase TRUE-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase FALSE-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---empty string DQ-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string DQ-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string SQ-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---heredoc-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---undefined var-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---unset var-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---resource var-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, resource given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt index 122d1e4767..f4b91503bc 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt @@ -14,26 +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"; +} -//function name without quotes -var_dump( array_intersect_ukey($array1, $array2, unknown_function) ); ?> ===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 - -Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d - -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_intersect_variation1.phpt b/ext/standard/tests/array/array_intersect_variation1.phpt index 9536dd8c2a..d38a284496 100644 --- a/ext/standard/tests/array/array_intersect_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_variation1.phpt @@ -92,14 +92,22 @@ $arrays = array( // loop through each sub-array within $arrrays to check the behavior of array_intersect() $iterator = 1; foreach($arrays as $unexpected_value) { - echo "\n-- Iterator $iterator --"; - - // Calling array_intersect() with default arguments - var_dump( array_intersect($unexpected_value,$arr2) ); - - // Calling array_intersect() with more arguments - var_dump( array_intersect($unexpected_value, $arr2, $arr3) ); - $iterator++; + echo "\n-- Iterator $iterator --"; + + // Calling array_intersect() with default arguments + try { + var_dump( array_intersect($unexpected_value,$arr2) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + // Calling array_intersect() with more arguments + try { + var_dump( array_intersect($unexpected_value, $arr2, $arr3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; } // close the file resource used @@ -107,174 +115,78 @@ fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_intersect() : Passing non-array values to $arr1 argument *** --- Iterator 1 -- -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iterator 2 -- -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iterator 3 -- -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iterator 4 -- -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iterator 5 -- -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iterator 6 -- -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iterator 7 -- -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iterator 8 -- -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iterator 9 -- -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iterator 10 -- -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iterator 11 -- -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iterator 12 -- -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - --- Iterator 13 -- -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iterator 1 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iterator 2 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --- Iterator 14 -- -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iterator 3 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iterator 4 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --- Iterator 15 -- -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iterator 5 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iterator 6 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --- Iterator 16 -- -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 7 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 8 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --- Iterator 17 -- -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 9 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 10 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --- Iterator 18 -- -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 11 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 12 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --- Iterator 19 -- -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 13 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 14 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --- Iterator 20 -- -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 15 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 16 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --- Iterator 21 -- -Warning: array_intersect(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +-- Iterator 17 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given -Warning: array_intersect(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +-- Iterator 18 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --- Iterator 22 -- -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iterator 19 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iterator 20 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --- Iterator 23 -- -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iterator 21 --Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iterator 22 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --- Iterator 24 -- -Warning: array_intersect(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +-- Iterator 23 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given -Warning: array_intersect(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +-- Iterator 24 --Expected parameter 1 to be an array, resource given +Expected parameter 1 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_intersect_variation2.phpt b/ext/standard/tests/array/array_intersect_variation2.phpt index 1db37b8467..08f6c9bb48 100644 --- a/ext/standard/tests/array/array_intersect_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_variation2.phpt @@ -92,15 +92,23 @@ $arrays = array( // loop through each sub-array within $arrrays to check the behavior of array_intersect() $iterator = 1; foreach($arrays as $unexpected_value) { - echo "\n-- Iterator $iterator --"; - - // Calling array_intersect() with default arguments - var_dump( array_intersect($arr1,$unexpected_value) ); - - // Calling array_intersect() with more arguments - var_dump( array_intersect($arr1, $unexpected_value, $arr3) ); - - $iterator++; + echo "\n-- Iterator $iterator --"; + + // Calling array_intersect() with default arguments + try { + var_dump( array_intersect($arr1,$unexpected_value) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + // Calling array_intersect() with more arguments + try { + var_dump( array_intersect($arr1, $unexpected_value, $arr3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + $iterator++; } // close the file resource used @@ -108,174 +116,78 @@ fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_intersect() : Passing non-array values to $arr2 argument *** --- Iterator 1 -- -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iterator 2 -- -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iterator 3 -- -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iterator 4 -- -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iterator 5 -- -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iterator 6 -- -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iterator 7 -- -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iterator 8 -- -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iterator 9 -- -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iterator 10 -- -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - --- Iterator 11 -- -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - --- Iterator 12 -- -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - --- Iterator 13 -- -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iterator 1 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iterator 2 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --- Iterator 14 -- -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iterator 3 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iterator 4 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --- Iterator 15 -- -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iterator 5 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iterator 6 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --- Iterator 16 -- -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 7 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 8 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --- Iterator 17 -- -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 9 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 10 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --- Iterator 18 -- -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 11 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 12 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --- Iterator 19 -- -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 13 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 14 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --- Iterator 20 -- -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 15 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 16 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --- Iterator 21 -- -Warning: array_intersect(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +-- Iterator 17 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given -Warning: array_intersect(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +-- Iterator 18 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --- Iterator 22 -- -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iterator 19 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iterator 20 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --- Iterator 23 -- -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iterator 21 --Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iterator 22 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --- Iterator 24 -- -Warning: array_intersect(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +-- Iterator 23 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given -Warning: array_intersect(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +-- Iterator 24 --Expected parameter 2 to be an array, resource given +Expected parameter 2 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt index 78a144f829..f66648f17d 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 deleted file mode 100644 index 46a989b839..0000000000 --- a/ext/standard/tests/array/array_keys_error.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -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 -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 - -Warning: Illegal offset type in %s on line %d -array(3) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - int(2) -} -Done 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 b808381048..43cc4484e6 100644 --- a/ext/standard/tests/array/array_map_object1.phpt +++ b/ext/standard/tests/array/array_map_object1.phpt @@ -22,13 +22,17 @@ echo "-- simple class with public variable and method --\n"; class SimpleClass { public $var1 = 1; - public function square($n) { + public static function square($n) { return $n * $n; } } 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)); @@ -36,7 +40,7 @@ echo "\n-- simple class with private variable and method --\n"; class SimpleClassPri { private $var1 = 10; - private function add($n) { + private static function add($n) { return $var + $n; } } @@ -46,7 +50,7 @@ echo "\n-- simple class with protected variable and method --\n"; class SimpleClassPro { protected $var1 = 5; - protected function mul($n) { + protected static function mul($n) { return $var1 * $n; } } @@ -62,14 +66,14 @@ echo "\n-- abstract class --\n"; abstract class AbstractClass { protected $var2 = 5; - abstract function emptyFunction(); + abstract static function emptyFunction(); } // class deriving the above abstract class class ChildClass extends AbstractClass { private $var3; - public function emptyFunction() { + public static function emptyFunction() { echo "defined in child\n"; } } @@ -79,7 +83,7 @@ echo "\n-- class with final method --\n"; class FinalClass { private $var4; - final function finalMethod() { + final static function finalMethod() { echo "This function can't be overloaded\n"; } } @@ -126,8 +130,6 @@ test(array('InterClass', 'square'), array(1, 2)); *** Testing array_map() : object functionality *** -- simple class with public variable and method -- SimpleClass::square - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method SimpleClass::square() should not be called statically in %sarray_map_object1.php on line %d array(2) { [0]=> int(1) @@ -137,26 +139,18 @@ 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 - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method ChildClass::emptyFunction() should not be called statically in %sarray_map_object1.php on line %d defined in child defined in child array(2) { @@ -168,8 +162,6 @@ array(2) { -- class with final method -- FinalClass::finalMethod - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method FinalClass::finalMethod() should not be called statically in %sarray_map_object1.php on line %d This function can't be overloaded This function can't be overloaded array(2) { @@ -188,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_variation10.phpt b/ext/standard/tests/array/array_map_variation10.phpt index 5b80126966..df071a414b 100644 --- a/ext/standard/tests/array/array_map_variation10.phpt +++ b/ext/standard/tests/array/array_map_variation10.phpt @@ -33,11 +33,15 @@ echo "-- anonymous function with NULL body --\n"; var_dump( array_map( function($a) { }, $array1)); echo "-- passing NULL as 'arr1' --\n"; -var_dump( array_map( function($a) { return array($a); }, NULL)); +try { + var_dump( array_map( function($a) { return array($a); }, NULL)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_map() : anonymous callback function *** -- anonymous function with all parameters and body -- array(3) { @@ -84,7 +88,5 @@ array(3) { NULL } -- passing NULL as 'arr1' -- - -Warning: array_map(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given 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_map_variation4.phpt b/ext/standard/tests/array/array_map_variation4.phpt index e5b4c062c1..08599e0567 100644 --- a/ext/standard/tests/array/array_map_variation4.phpt +++ b/ext/standard/tests/array/array_map_variation4.phpt @@ -58,10 +58,10 @@ $arrays = array ( array("hello", $heredoc => "string"), // heredoc // array with object, unset variable and resource variable - array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), + array(@$unset_var => "hello", $fp => 'resource'), // array with mixed values -/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, +/*11*/ array('hello' => 1, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); @@ -79,12 +79,8 @@ echo "Done"; --EXPECTF-- *** Testing array_map() : associative array with diff. keys for 'arr1' argument *** -Warning: Illegal offset type in %s on line %d - Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d -Warning: Illegal offset type in %s on line %d - Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d -- Iteration 1 -- array(0) { diff --git a/ext/standard/tests/array/array_merge.phpt b/ext/standard/tests/array/array_merge.phpt index 0afc2084af..08ecbf7147 100644 --- a/ext/standard/tests/array/array_merge.phpt +++ b/ext/standard/tests/array/array_merge.phpt @@ -78,12 +78,6 @@ 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 ***"; -/* Invalid arguments */ -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)); - echo "\n*** Testing array_merge without any arguments ***\n"; var_dump(array_merge()); @@ -747,18 +741,6 @@ array(7) { float(12.34) } -*** Testing error conditions *** -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 - *** Testing array_merge without any arguments *** array(0) { } diff --git a/ext/standard/tests/array/array_merge_recursive_variation1.phpt b/ext/standard/tests/array/array_merge_recursive_variation1.phpt index 071e9eadb5..3d15d56b81 100644 --- a/ext/standard/tests/array/array_merge_recursive_variation1.phpt +++ b/ext/standard/tests/array/array_merge_recursive_variation1.phpt @@ -88,17 +88,25 @@ $arr2 = array(1, array("hello", 'world')); // loop through each element of $arrays and check the behavior of array_merge_recursive() $iterator = 1; foreach($arrays as $arr1) { - echo "\n-- Iteration $iterator --"; - - // with default argument - echo "\n-- With default argument --"; - var_dump( array_merge_recursive($arr1) ); - - // with more arguments - echo "-- With more arguments --"; - var_dump( array_merge_recursive($arr1, $arr2) ); - - $iterator++; + echo "\n-- Iteration $iterator --"; + + // with default argument + echo "\n-- With default argument --"; + try { + var_dump( array_merge_recursive($arr1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + // with more arguments + echo "-- With more arguments --"; + try { + var_dump( array_merge_recursive($arr1, $arr2) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + $iterator++; } // close the file resource used @@ -106,198 +114,102 @@ fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_merge_recursive() : Passing non array values to $arr1 argument *** -- Iteration 1 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, int given +-- With more arguments --Expected parameter 1 to be an array, int given -- Iteration 2 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, int given +-- With more arguments --Expected parameter 1 to be an array, int given -- Iteration 3 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, int given +-- With more arguments --Expected parameter 1 to be an array, int given -- Iteration 4 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, int given +-- With more arguments --Expected parameter 1 to be an array, int given -- Iteration 5 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, float given +-- With more arguments --Expected parameter 1 to be an array, float given -- Iteration 6 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, float given +-- With more arguments --Expected parameter 1 to be an array, float given -- Iteration 7 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, float given +-- With more arguments --Expected parameter 1 to be an array, float given -- Iteration 8 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, float given +-- With more arguments --Expected parameter 1 to be an array, float given -- Iteration 9 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, float given +-- With more arguments --Expected parameter 1 to be an array, float given -- Iteration 10 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, null given +-- With more arguments --Expected parameter 1 to be an array, null given -- Iteration 11 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, null given +-- With more arguments --Expected parameter 1 to be an array, null given -- Iteration 12 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, bool given +-- With more arguments --Expected parameter 1 to be an array, bool given -- Iteration 13 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, bool given +-- With more arguments --Expected parameter 1 to be an array, bool given -- Iteration 14 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, bool given +-- With more arguments --Expected parameter 1 to be an array, bool given -- Iteration 15 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, bool given +-- With more arguments --Expected parameter 1 to be an array, bool given -- Iteration 16 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, string given +-- With more arguments --Expected parameter 1 to be an array, string given -- Iteration 17 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, string given +-- With more arguments --Expected parameter 1 to be an array, string given -- Iteration 18 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, string given +-- With more arguments --Expected parameter 1 to be an array, string given -- Iteration 19 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, string given +-- With more arguments --Expected parameter 1 to be an array, string given -- Iteration 20 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, string given +-- With more arguments --Expected parameter 1 to be an array, string given -- Iteration 21 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, null given +-- With more arguments --Expected parameter 1 to be an array, null given -- Iteration 22 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, null given +-- With more arguments --Expected parameter 1 to be an array, null given -- Iteration 23 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, resource given +-- With more arguments --Expected parameter 1 to be an array, resource given -- Iteration 24 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, object given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, object given +-- With more arguments --Expected parameter 1 to be an array, object given Done diff --git a/ext/standard/tests/array/array_merge_recursive_variation2.phpt b/ext/standard/tests/array/array_merge_recursive_variation2.phpt index f14d5d9bb3..eec9634630 100644 --- a/ext/standard/tests/array/array_merge_recursive_variation2.phpt +++ b/ext/standard/tests/array/array_merge_recursive_variation2.phpt @@ -88,9 +88,13 @@ $arrays = array ( // loop through each element of $arrays and check the behavior of array_merge_recursive() $iterator = 1; foreach($arrays as $arr2) { - echo "\n-- Iteration $iterator --"; - var_dump( array_merge_recursive($arr1, $arr2) ); - $iterator++; + echo "\n-- Iteration $iterator --"; + try { + var_dump( array_merge_recursive($arr1, $arr2) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; } // close the file resource used @@ -98,102 +102,54 @@ fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_merge_recursive() : Passing non array values to $arr2 argument *** --- Iteration 1 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 1 --Expected parameter 2 to be an array, int given --- Iteration 2 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 2 --Expected parameter 2 to be an array, int given --- Iteration 3 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 3 --Expected parameter 2 to be an array, int given --- Iteration 4 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 4 --Expected parameter 2 to be an array, int given --- Iteration 5 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 5 --Expected parameter 2 to be an array, float given --- Iteration 6 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 6 --Expected parameter 2 to be an array, float given --- Iteration 7 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 7 --Expected parameter 2 to be an array, float given --- Iteration 8 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 8 --Expected parameter 2 to be an array, float given --- Iteration 9 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 9 --Expected parameter 2 to be an array, float given --- Iteration 10 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 10 --Expected parameter 2 to be an array, null given --- Iteration 11 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 11 --Expected parameter 2 to be an array, null given --- Iteration 12 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 12 --Expected parameter 2 to be an array, bool given --- Iteration 13 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 13 --Expected parameter 2 to be an array, bool given --- Iteration 14 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 14 --Expected parameter 2 to be an array, bool given --- Iteration 15 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 15 --Expected parameter 2 to be an array, bool given --- Iteration 16 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 16 --Expected parameter 2 to be an array, string given --- Iteration 17 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 17 --Expected parameter 2 to be an array, string given --- Iteration 18 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 18 --Expected parameter 2 to be an array, string given --- Iteration 19 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 19 --Expected parameter 2 to be an array, string given --- Iteration 20 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 20 --Expected parameter 2 to be an array, string given --- Iteration 21 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 21 --Expected parameter 2 to be an array, null given --- Iteration 22 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 22 --Expected parameter 2 to be an array, null given --- Iteration 23 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +-- Iteration 23 --Expected parameter 2 to be an array, resource given --- Iteration 24 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +-- Iteration 24 --Expected parameter 2 to be an array, object given Done diff --git a/ext/standard/tests/array/array_merge_recursive_variation4.phpt b/ext/standard/tests/array/array_merge_recursive_variation4.phpt index f2c1e82a0c..151a515205 100644 --- a/ext/standard/tests/array/array_merge_recursive_variation4.phpt +++ b/ext/standard/tests/array/array_merge_recursive_variation4.phpt @@ -50,7 +50,7 @@ $arrays = array ( array("hello", $heredoc => array("heredoc", 'string'), "string"), // array with object, unset variable and resource variable -/*8*/ array(new classA() => 11, @$unset_var => array("unset"), $fp => 'resource', 11, "hello") +/*8*/ array(@$unset_var => array("unset"), $fp => 'resource', 11, "hello") ); // initialise the second array @@ -80,8 +80,6 @@ echo "Done"; --EXPECTF-- *** Testing array_merge_recursive() : assoc. array with diff. keys to $arr1 argument *** -Warning: Illegal offset type in %s on line %d - Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d -- Iteration 1 -- -- With default argument -- diff --git a/ext/standard/tests/array/array_merge_variation1.phpt b/ext/standard/tests/array/array_merge_variation1.phpt index 0335fe473b..16e702e8a1 100644 --- a/ext/standard/tests/array/array_merge_variation1.phpt +++ b/ext/standard/tests/array/array_merge_variation1.phpt @@ -102,129 +102,8 @@ echo "Done"; -- Iteration 1 -- -Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - --- Iteration 18 -- -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} - --- Iteration 19 -- - -Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: array_merge(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: array_merge(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL -Done +Fatal error: Uncaught TypeError: Expected parameter 1 to be an array, int given in %s:%d +Stack trace: +#0 %s(%d): array_merge(0, Array) +#1 {main} + thrown in %s on line %d diff --git a/ext/standard/tests/array/array_merge_variation2.phpt b/ext/standard/tests/array/array_merge_variation2.phpt index fd7e9ccfc8..57715d484b 100644 --- a/ext/standard/tests/array/array_merge_variation2.phpt +++ b/ext/standard/tests/array/array_merge_variation2.phpt @@ -88,102 +88,72 @@ $inputs = array( // loop through each element of $inputs to check the behavior of array_merge() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_merge($arr1, $input) ); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + try { + var_dump( array_merge($arr1, $input) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_merge() : usage variations *** -- Iteration 1 -- - -Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 2 -- - -Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 3 -- - -Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 4 -- - -Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 5 -- - -Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 6 -- - -Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 7 -- - -Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 8 -- - -Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 9 -- - -Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 10 -- - -Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 11 -- - -Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 12 -- - -Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 13 -- - -Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 14 -- - -Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 15 -- - -Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 16 -- - -Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 17 -- - -Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 18 -- array(2) { @@ -194,37 +164,23 @@ array(2) { } -- Iteration 19 -- - -Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 20 -- - -Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 21 -- - -Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 22 -- - -Warning: array_merge(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given -- Iteration 23 -- - -Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 24 -- - -Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 25 -- - -Warning: array_merge(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_multisort_error.phpt b/ext/standard/tests/array/array_multisort_error.phpt index 3e78b78ac0..5d3bab456a 100644 --- a/ext/standard/tests/array/array_multisort_error.phpt +++ b/ext/standard/tests/array/array_multisort_error.phpt @@ -10,35 +10,30 @@ 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) ); +try { + var_dump( array_multisort($ar1, SORT_ASC, SORT_ASC) ); +} catch (Error $e) { + echo $e->getMessage() . "\n"; +} echo "\n-- Testing array_multisort() function with repeated flags --\n"; $ar1 = array(1); -var_dump( array_multisort($ar1, SORT_STRING, SORT_NUMERIC) ); +try { + var_dump( array_multisort($ar1, SORT_STRING, SORT_NUMERIC) ); +} catch (Error $e) { + echo $e->getMessage() . "\n"; +} ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** 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 -bool(false) +Argument #3 is expected to be an array or sorting flag that has not already been specified -- 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 -bool(false) +Argument #3 is expected to be an array or sorting flag that has not already been specified ===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation1.phpt b/ext/standard/tests/array/array_multisort_variation1.phpt index 9a33a270f1..763944054a 100644 --- a/ext/standard/tests/array/array_multisort_variation1.phpt +++ b/ext/standard/tests/array/array_multisort_variation1.phpt @@ -11,8 +11,8 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } @@ -97,111 +97,90 @@ $inputs = array( foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( array_multisort($value)); + try { + var_dump( array_multisort($value)); + } catch (Error $e) { + echo $e->getMessage() . "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_multisort() : usage variation *** --int 0-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or sorting flag that has not already been specified --int 1-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or sorting flag that has not already been specified --int 12345-- -Error: 2 - array_multisort(): Argument #1 is an unknown sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is an unknown sort flag --int -12345-- -Error: 2 - array_multisort(): Argument #1 is an unknown sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is an unknown sort flag --float 10.5-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --float -10.5-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --float 12.3456789000e10-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --float -12.3456789000e10-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --float .5-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --uppercase NULL-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --lowercase null-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --lowercase true-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --lowercase false-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --uppercase TRUE-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --uppercase FALSE-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --empty string DQ-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --empty string SQ-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --string DQ-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --string SQ-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --mixed case string-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --heredoc-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --instance of classWithToString-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --instance of classWithoutToString-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --undefined var-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --unset var-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag ===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation2.phpt b/ext/standard/tests/array/array_multisort_variation2.phpt index 8c26a8347b..b23d8b19fa 100644 --- a/ext/standard/tests/array/array_multisort_variation2.phpt +++ b/ext/standard/tests/array/array_multisort_variation2.phpt @@ -11,8 +11,8 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } @@ -104,13 +104,17 @@ $inputs = array( // loop through each element of the array for SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_NATURAL|SORT_FLAG_CASE]] foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_multisort($ar1, $value) ); + echo "\n--$key--\n"; + try { + var_dump( array_multisort($ar1, $value) ); + } catch (Error $e) { + echo $e->getMessage() . "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_multisort() : usage variation *** --int 0-- @@ -120,109 +124,83 @@ bool(true) bool(true) --int 12345-- -Error: 2 - array_multisort(): Argument #2 is an unknown sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is an unknown sort flag --int -12345-- -Error: 2 - array_multisort(): Argument #2 is an unknown sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is an unknown sort flag --float 10.5-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --float -10.5-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --float 12.3456789000e10-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --float -12.3456789000e10-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --float .5-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --empty array-- -Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d) -bool(false) +Array sizes are inconsistent --int indexed array-- -Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d) -bool(false) +Array sizes are inconsistent --associative array-- bool(true) --nested arrays-- -Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d) -bool(false) +Array sizes are inconsistent --uppercase NULL-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --lowercase null-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --lowercase true-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --lowercase false-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --uppercase TRUE-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --uppercase FALSE-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --empty string DQ-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --empty string SQ-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --string DQ-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --string SQ-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --mixed case string-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --heredoc-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --instance of classWithToString-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --instance of classWithoutToString-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --undefined var-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --unset var-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag ===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation3.phpt b/ext/standard/tests/array/array_multisort_variation3.phpt index 28130e31fd..42b1d9fbe5 100644 --- a/ext/standard/tests/array/array_multisort_variation3.phpt +++ b/ext/standard/tests/array/array_multisort_variation3.phpt @@ -11,8 +11,8 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } @@ -95,114 +95,92 @@ $inputs = array( ); // loop through each element of the array for ar2 - foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_multisort($ar1, SORT_REGULAR, $value) ); + echo "\n--$key--\n"; + try { + var_dump( array_multisort($ar1, SORT_REGULAR, $value) ); + } catch (Error $e) { + echo $e->getMessage() . "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_multisort() : usage variation *** --int 0-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or sorting flag that has not already been specified --int 1-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or sorting flag that has not already been specified --int 12345-- -Error: 2 - array_multisort(): Argument #3 is an unknown sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is an unknown sort flag --int -12345-- -Error: 2 - array_multisort(): Argument #3 is an unknown sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is an unknown sort flag --float 10.5-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --float -10.5-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --float 12.3456789000e10-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --float -12.3456789000e10-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --float .5-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --uppercase NULL-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --lowercase null-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --lowercase true-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --lowercase false-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --uppercase TRUE-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --uppercase FALSE-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --empty string DQ-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --empty string SQ-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --string DQ-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --string SQ-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --mixed case string-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --heredoc-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --instance of classWithToString-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --instance of classWithoutToString-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --undefined var-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --unset var-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag ===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation8.phpt b/ext/standard/tests/array/array_multisort_variation8.phpt index 00b0ccb012..d681ef92c5 100644 --- a/ext/standard/tests/array/array_multisort_variation8.phpt +++ b/ext/standard/tests/array/array_multisort_variation8.phpt @@ -11,7 +11,7 @@ Test array_multisort() function : usage variation - test sort order of all types echo "*** Testing array_multisort() : usage variation - test sort order of all types***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { // We're testing sort order not errors so ignore. } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/array/array_pad.phpt b/ext/standard/tests/array/array_pad.phpt index c267516730..ce6e1b2b04 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)); @@ -15,20 +12,17 @@ var_dump(array_pad(array("", -1, 2.0), 5, array())); 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 +try { + var_dump(array_pad(array("", -1, 2.0), 2000000, 0)); +} catch (Error $e) { + echo $e->getMessage() . "\n"; +} -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 +DONE +--EXPECT-- array(1) { [0]=> int(0) @@ -92,10 +86,6 @@ array(4) { [3]=> float(2) } +You may only pad up to 1048576 elements at a time -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 +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..5895727548 100644 --- a/ext/standard/tests/array/array_rand.phpt +++ b/ext/standard/tests/array/array_rand.phpt @@ -3,39 +3,47 @@ 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)); -var_dump(array_rand(array(1,2,3), 3)); -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 +try { + var_dump(array_rand(array())); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -Warning: array_rand(): Array is empty in %s on line %d -NULL +try { + var_dump(array_rand(array(), 0)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -Warning: array_rand(): Array is empty in %s on line %d -NULL +try { + var_dump(array_rand(array(1,2,3), 0)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d -NULL +try { + var_dump(array_rand(array(1,2,3), -1)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL +try { + var_dump(array_rand(array(1,2,3), 10)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL +var_dump(array_rand(array(1,2,3), 3)); +var_dump(array_rand(array(1,2,3), 2)); -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL +echo "Done\n"; +?> +--EXPECTF-- +Array is empty +Array is empty +Second argument has to be between 1 and the number of elements in the array +Second argument has to be between 1 and the number of elements in the array +Second argument has to be between 1 and the number of elements in the array array(3) { [0]=> int(%d) diff --git a/ext/standard/tests/array/array_rand_variation5.phpt b/ext/standard/tests/array/array_rand_variation5.phpt index 30eb7d7801..03e20d6e07 100644 --- a/ext/standard/tests/array/array_rand_variation5.phpt +++ b/ext/standard/tests/array/array_rand_variation5.phpt @@ -32,17 +32,36 @@ var_dump( array_rand($input, 1) ); // with valid $num_req value // with invalid num_req value echo"\n-- With num_req = 0 --\n"; -var_dump( array_rand($input, 0) ); // with $num_req=0 +try { + var_dump( array_rand($input, 0) ); // with $num_req=0 +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + echo"\n-- With num_req = -1 --\n"; -var_dump( array_rand($input, -1) ); // with $num_req=-1 +try { + var_dump( array_rand($input, -1) ); // with $num_req=-1 +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + echo"\n-- With num_req = -2 --\n"; -var_dump( array_rand($input, -2) ); // with $num_req=-2 -echo"\n-- With num_req more than number of members in 'input' array --\n"; -var_dump( array_rand($input, 13) ); // with $num_req=13 +try { + var_dump( array_rand($input, -2) ); // with $num_req=-2 +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} +echo"\n-- With num_req more than number of members in 'input' array --\n"; +try { + var_dump( array_rand($input, 13) ); // with $num_req=13 +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -echo "Done"; ?> + +DONE --EXPECTF-- *** Testing array_rand() : with invalid values for 'req_num' *** @@ -53,22 +72,15 @@ int(%d) int(%d) -- With num_req = 0 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL +Second argument has to be between 1 and the number of elements in the array -- With num_req = -1 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL +Second argument has to be between 1 and the number of elements in the array -- With num_req = -2 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL +Second argument has to be between 1 and the number of elements in the array -- With num_req more than number of members in 'input' array -- +Second argument has to be between 1 and the number of elements in the array -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL -Done +DONE diff --git a/ext/standard/tests/array/array_replace.phpt b/ext/standard/tests/array/array_replace.phpt index 6ba9e43fd7..48b616ab04 100644 --- a/ext/standard/tests/array/array_replace.phpt +++ b/ext/standard/tests/array/array_replace.phpt @@ -42,11 +42,15 @@ $data = array_replace_recursive($array1, $array2); var_dump($data); echo " -- Testing array_replace_recursive() w/ endless recusrsion --\n"; -$data = array_replace_recursive($array3, $array4); +try { + $data = array_replace_recursive($array3, $array4); + var_dump($data); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -var_dump($data); ?> ---EXPECTF-- +--EXPECT-- -- Testing array_replace() -- array(5) { [0]=> @@ -107,16 +111,4 @@ array(5) { } } -- Testing array_replace_recursive() w/ endless recusrsion -- - -Warning: array_replace_recursive(): recursion detected in %s on line %d -array(1) { - [0]=> - array(1) { - [0]=> - array(1) { - [0]=> - array(0) { - } - } - } -} +Recursion detected diff --git a/ext/standard/tests/array/array_reverse_variation4.phpt b/ext/standard/tests/array/array_reverse_variation4.phpt index 09b2eb4bee..f6e98dae82 100644 --- a/ext/standard/tests/array/array_reverse_variation4.phpt +++ b/ext/standard/tests/array/array_reverse_variation4.phpt @@ -54,10 +54,10 @@ $arrays = array ( array("hello", $heredoc => "string"), // heredoc // array with object, unset variable and resource variable - array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), + array(@$unset_var => "hello", $fp => 'resource'), // array with mixed values -/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") +/*11*/ array('hello' => 1, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); // loop through the various elements of $arrays to test array_reverse() @@ -83,12 +83,8 @@ echo "Done"; --EXPECTF-- *** Testing array_reverse() : usage variations *** -Warning: Illegal offset type in %s on line %d - Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d -Warning: Illegal offset type in %s on line %d - Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d -- Iteration 1 -- - default argument - 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 7b6d712a1f..46f33b9503 100644 --- a/ext/standard/tests/array/array_slice_variation1.phpt +++ b/ext/standard/tests/array/array_slice_variation1.phpt @@ -15,12 +15,20 @@ 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); ?> ---EXPECT-- +--EXPECTF-- array(3) { [0]=> int(1) @@ -53,8 +61,6 @@ array(1) { [2]=> int(3) } -array(0) { -} -array(0) { -} +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_slice_variation2.phpt b/ext/standard/tests/array/array_slice_variation2.phpt deleted file mode 100644 index a76d68e6e0..0000000000 --- a/ext/standard/tests/array/array_slice_variation2.phpt +++ /dev/null @@ -1,303 +0,0 @@ ---TEST-- -Test array_slice() function : usage variations - Pass different data types as $offset arg ---SKIPIF-- -<?php if (PHP_INT_SIZE > 4) die("skip this test is for 32bit platform only"); ?> ---FILE-- -<?php -/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]]) - * Description: Returns elements specified by offset and length - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $offset argument to array_slice() to test behaviour - */ - -echo "*** Testing array_slice() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$input_array = array('one' => 1, 2, 'three' => 3, 4); - -//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 $offset 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, - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of array_slice() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_slice($input_array, $input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_slice() : usage variations *** - --- Iteration 1 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 2 -- -array(3) { - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 3 -- -array(0) { -} - --- Iteration 4 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 5 -- -array(0) { -} - --- Iteration 6 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 7 -- - -Warning: array_slice() expects parameter 2 to be int, float given in %s on line %d -NULL - --- Iteration 8 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 9 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 10 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 11 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 12 -- -array(3) { - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 13 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 14 -- -array(3) { - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 15 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 16 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: array_slice() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 23 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} -Done diff --git a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt index 2cbc9572d2..9f320c04ad 100644 --- a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff_assoc($value, $arr2, $key_comp_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_udiff_assoc($value, $arr2, $key_comp_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_udiff_assoc() : usage variation *** --int 0-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt index 1a2c1ed978..e0eaaf63ce 100644 --- a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff_assoc($arr1, $value, $key_comp_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_udiff_assoc($arr1, $value, $key_comp_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_udiff_assoc() : usage variation *** --int 0-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation4.phpt b/ext/standard/tests/array/array_udiff_assoc_variation4.phpt deleted file mode 100644 index 20a5afa202..0000000000 --- a/ext/standard/tests/array/array_udiff_assoc_variation4.phpt +++ /dev/null @@ -1,228 +0,0 @@ ---TEST-- -Test array_udiff_assoc() function : usage variation ---FILE-- -<?php -/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func) - * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function. - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing array_udiff_assoc() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$arr1 = array(1, 2); -$arr2 = array(1, 2); - -include('compare_function.inc'); -$key_comp_func = 'compare_function'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for ... - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff_assoc($arr1, $arr2, $value, $key_comp_func) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing array_udiff_assoc() : usage variation *** - ---int 0-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---int 1-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---int 12345-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---int -12345-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---float 10.5-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---float -10.5-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---float .5-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---uppercase NULL-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---lowercase null-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---lowercase true-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---lowercase false-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---uppercase TRUE-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---uppercase FALSE-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---empty string DQ-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---empty string SQ-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---string DQ-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---string SQ-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---mixed case string-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---heredoc-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---instance of classWithToString-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---undefined var-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---unset var-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt index 4496194b62..bbc213aee4 100644 --- a/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt @@ -92,137 +92,91 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff_uassoc($value, $arr2, $data_comp_func, $key_comp_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_udiff_uassoc($value, $arr2, $data_comp_func, $key_comp_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_udiff_uassoc() : usage variation *** --int 0-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt index 2324c5a47b..9466dc952b 100644 --- a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt @@ -92,137 +92,91 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff_uassoc($arr1, $value, $data_comp_func, $key_comp_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_udiff_uassoc($arr1, $value, $data_comp_func, $key_comp_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_udiff_uassoc() : usage variation *** --int 0-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt deleted file mode 100644 index 820f0466ad..0000000000 --- a/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt +++ /dev/null @@ -1,229 +0,0 @@ ---TEST-- -Test array_udiff_uassoc() function : usage variation ---FILE-- -<?php -/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func) - * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions. - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing array_udiff_uassoc() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$arr1 = array(1, 2); -$arr2 = array(1, 2); - -include('compare_function.inc'); -$data_comp_func = 'compare_function'; -$key_comp_func = 'compare_function'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for ... - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff_uassoc($arr1, $arr2, $value, $data_comp_func, $key_comp_func) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing array_udiff_uassoc() : usage variation *** - ---int 0-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---int 1-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---int 12345-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---int -12345-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---float 10.5-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---float -10.5-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---float .5-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---uppercase NULL-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---lowercase null-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---lowercase true-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---lowercase false-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---uppercase TRUE-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---uppercase FALSE-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---empty string DQ-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---empty string SQ-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---string DQ-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---string SQ-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---mixed case string-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---heredoc-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---instance of classWithToString-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---undefined var-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---unset var-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_udiff_variation1.phpt b/ext/standard/tests/array/array_udiff_variation1.phpt index 5eb84146a1..f462be78c0 100644 --- a/ext/standard/tests/array/array_udiff_variation1.phpt +++ b/ext/standard/tests/array/array_udiff_variation1.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff($value, $arr2, $data_comp_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_udiff($value, $arr2, $data_comp_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_udiff() : usage variation *** --int 0-- - -Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_udiff(): Expected parameter 1 to be an array, object given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_udiff(): Expected parameter 1 to be an array, object given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_udiff_variation2.phpt b/ext/standard/tests/array/array_udiff_variation2.phpt index 61aa1f0c9a..ee478837cd 100644 --- a/ext/standard/tests/array/array_udiff_variation2.phpt +++ b/ext/standard/tests/array/array_udiff_variation2.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff($arr1, $value, $data_comp_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_udiff($arr1, $value, $data_comp_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_udiff() : usage variation *** --int 0-- - -Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_udiff(): Expected parameter 2 to be an array, object given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_udiff(): Expected parameter 2 to be an array, object given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_udiff_variation4.phpt b/ext/standard/tests/array/array_udiff_variation4.phpt deleted file mode 100644 index a92c5ddfdf..0000000000 --- a/ext/standard/tests/array/array_udiff_variation4.phpt +++ /dev/null @@ -1,228 +0,0 @@ ---TEST-- -Test array_udiff() function : usage variation ---FILE-- -<?php -/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func) - * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments. Elements are compared by user supplied function. - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing array_udiff() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$arr1 = array(1, 2); -$arr2 = array(1, 2); - -include('compare_function.inc'); -$data_comp_func = 'compare_function'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for ... - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff($arr1, $arr2, $value, $data_comp_func) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing array_udiff() : usage variation *** - ---int 0-- - -Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d -NULL - ---int 1-- - -Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d -NULL - ---int 12345-- - -Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d -NULL - ---int -12345-- - -Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d -NULL - ---float 10.5-- - -Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d -NULL - ---float -10.5-- - -Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d -NULL - ---float .5-- - -Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d -NULL - ---uppercase NULL-- - -Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d -NULL - ---lowercase null-- - -Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d -NULL - ---lowercase true-- - -Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d -NULL - ---lowercase false-- - -Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d -NULL - ---uppercase TRUE-- - -Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d -NULL - ---uppercase FALSE-- - -Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d -NULL - ---empty string DQ-- - -Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d -NULL - ---empty string SQ-- - -Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d -NULL - ---string DQ-- - -Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d -NULL - ---string SQ-- - -Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d -NULL - ---mixed case string-- - -Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d -NULL - ---heredoc-- - -Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d -NULL - ---instance of classWithToString-- - -Warning: array_udiff(): Expected parameter 3 to be an array, object given in %sarray_udiff_variation4.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_udiff(): Expected parameter 3 to be an array, object given in %sarray_udiff_variation4.php on line %d -NULL - ---undefined var-- - -Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d -NULL - ---unset var-- - -Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt index a2babcdb02..8a3ffe909d 100644 --- a/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect_assoc($value, $arr2, $data_compare_function) ); + echo "\n--$key--\n"; + try { + var_dump( array_uintersect_assoc($value, $arr2, $data_compare_function) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_uintersect_assoc() : usage variation *** --int 0-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt index 8723157506..3c04bd5a36 100644 --- a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect_assoc($arr1, $value, $data_compare_function) ); + echo "\n--$key--\n"; + try { + var_dump( array_uintersect_assoc($arr1, $value, $data_compare_function) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_uintersect_assoc() : usage variation *** --int 0-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt deleted file mode 100644 index 3024246a3d..0000000000 --- a/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt +++ /dev/null @@ -1,228 +0,0 @@ ---TEST-- -Test array_uintersect_assoc() function : usage variation ---FILE-- -<?php -/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func) - * Description: U - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing array_uintersect_assoc() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$arr1 = array(1, 2); -$arr2 = array(1, 2); - -include('compare_function.inc'); -$data_compare_function = 'compare_function'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for ... - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect_assoc($arr1, $arr2, $value, $data_compare_function ) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing array_uintersect_assoc() : usage variation *** - ---int 0-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---int 1-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---int 12345-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---int -12345-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---float 10.5-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---float -10.5-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---float .5-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---uppercase NULL-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---lowercase null-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---lowercase true-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---lowercase false-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---uppercase TRUE-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---uppercase FALSE-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---empty string DQ-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---empty string SQ-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---string DQ-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---string SQ-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---mixed case string-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---heredoc-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---instance of classWithToString-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---undefined var-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---unset var-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt index 84d4e634cf..385fffed96 100644 --- a/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt @@ -92,137 +92,91 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect_uassoc($value, $arr2, $data_compare_func, $key_compare_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_uintersect_uassoc($value, $arr2, $data_compare_func, $key_compare_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_uintersect_uassoc() : usage variation *** --int 0-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt index 8692026fc4..74eeddf4ff 100644 --- a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt @@ -92,137 +92,91 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect_uassoc($arr1, $value, $data_compare_func, $key_compare_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_uintersect_uassoc($arr1, $value, $data_compare_func, $key_compare_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_uintersect_uassoc() : usage variation *** --int 0-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt deleted file mode 100644 index d1db008416..0000000000 --- a/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt +++ /dev/null @@ -1,229 +0,0 @@ ---TEST-- -Test array_uintersect_uassoc() function : usage variation ---FILE-- -<?php -/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func) - * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks. - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing array_uintersect_uassoc() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$arr1 = array(1, 2); -$arr2 = array(1, 2); - -include('compare_function.inc'); -$data_compare_func = 'compare_function'; -$key_compare_func = 'compare_function'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for ... - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect_uassoc($arr1, $arr2, $value, $data_compare_func, $key_compare_func) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing array_uintersect_uassoc() : usage variation *** - ---int 0-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---int 1-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---int 12345-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---int -12345-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---float 10.5-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---float -10.5-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---float .5-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---uppercase NULL-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---lowercase null-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---lowercase true-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---lowercase false-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---uppercase TRUE-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---uppercase FALSE-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---empty string DQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---empty string SQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---string DQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---string SQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---mixed case string-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---heredoc-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---instance of classWithToString-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---undefined var-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---unset var-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation1.phpt b/ext/standard/tests/array/array_uintersect_variation1.phpt index c88177018b..32e2177758 100644 --- a/ext/standard/tests/array/array_uintersect_variation1.phpt +++ b/ext/standard/tests/array/array_uintersect_variation1.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect($value, $arr2, $data_compare_function) ); + echo "\n--$key--\n"; + try { + var_dump( array_uintersect($value, $arr2, $data_compare_function) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_uintersect() : usage variation *** --int 0-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, object given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, object given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation2.phpt b/ext/standard/tests/array/array_uintersect_variation2.phpt index ee52e21c72..bf914e9bc6 100644 --- a/ext/standard/tests/array/array_uintersect_variation2.phpt +++ b/ext/standard/tests/array/array_uintersect_variation2.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect($arr1, $value, $data_compare_function) ); + echo "\n--$key--\n"; + try { + var_dump( array_uintersect($arr1, $value, $data_compare_function) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_uintersect() : usage variation *** --int 0-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, object given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, object given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation4.phpt b/ext/standard/tests/array/array_uintersect_variation4.phpt deleted file mode 100644 index abc33e591b..0000000000 --- a/ext/standard/tests/array/array_uintersect_variation4.phpt +++ /dev/null @@ -1,228 +0,0 @@ ---TEST-- -Test array_uintersect() function : usage variation ---FILE-- -<?php -/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func) - * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Data is compared by using an user-supplied callback. - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing array_uintersect() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$arr1 = array(1, 2); -$arr2 = array(1, 2); - -include('compare_function.inc'); -$data_compare_function = 'compare_function'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for ... - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect($arr1, $arr2, $value, $data_compare_function) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing array_uintersect() : usage variation *** - ---int 0-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d -NULL - ---int 1-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d -NULL - ---int 12345-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d -NULL - ---int -12345-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d -NULL - ---float 10.5-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d -NULL - ---float -10.5-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d -NULL - ---float .5-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d -NULL - ---uppercase NULL-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d -NULL - ---lowercase null-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d -NULL - ---lowercase true-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d -NULL - ---lowercase false-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d -NULL - ---uppercase TRUE-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d -NULL - ---uppercase FALSE-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d -NULL - ---empty string DQ-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d -NULL - ---empty string SQ-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d -NULL - ---string DQ-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d -NULL - ---string SQ-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d -NULL - ---mixed case string-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d -NULL - ---heredoc-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d -NULL - ---instance of classWithToString-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, object given in %sarray_uintersect_variation4.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, object given in %sarray_uintersect_variation4.php on line %d -NULL - ---undefined var-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d -NULL - ---unset var-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_unique_variation3.phpt b/ext/standard/tests/array/array_unique_variation3.phpt index 205bc3a576..e80df1fb65 100644 --- a/ext/standard/tests/array/array_unique_variation3.phpt +++ b/ext/standard/tests/array/array_unique_variation3.phpt @@ -50,7 +50,7 @@ $inputs = array ( array("hello", $heredoc => "string", "string"), // array with object, unset variable and resource variable -/*8*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource', 11, "hello"), +/*8*/ array(@$unset_var => "hello", $fp => 'resource', 11, "hello"), ); // loop through each sub-array of $inputs to check the behavior of array_unique() @@ -68,8 +68,6 @@ echo "Done"; --EXPECTF-- *** Testing array_unique() : assoc. array with diff. keys passed to $input argument *** -Warning: Illegal offset type in %s on line %d - Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d -- Iteration 1 -- array(1) { 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_unshift_variation4.phpt b/ext/standard/tests/array/array_unshift_variation4.phpt index 7f507c98d0..ee91bba180 100644 --- a/ext/standard/tests/array/array_unshift_variation4.phpt +++ b/ext/standard/tests/array/array_unshift_variation4.phpt @@ -63,10 +63,10 @@ $arrays = array ( array("hello", $heredoc => "string"), // heredoc // array with object, unset variable and resource variable - array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), + array(@$unset_var => "hello", $fp => 'resource'), // array with mixed keys -/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, +/*11*/ array('hello' => 1, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); @@ -101,12 +101,8 @@ echo "Done"; --EXPECTF-- *** Testing array_unshift() : associative array with different keys *** -Warning: Illegal offset type in %s on line %d - Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d -Warning: Illegal offset type in %s on line %d - Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d -- Iteration 1 -- int(1) 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/bug42177.phpt b/ext/standard/tests/array/bug42177.phpt index 5678ca3cac..dc5297b302 100644 --- a/ext/standard/tests/array/bug42177.phpt +++ b/ext/standard/tests/array/bug42177.phpt @@ -18,7 +18,11 @@ unset( $a1, $a2 ); $a1 = array(); $a2 = array( 'key1' => &$a1 ); $a1 = array_merge_recursive( $a1, $a2 ); -$a1 = array_merge_recursive( $a1, $a2 ); +try { + $a1 = array_merge_recursive( $a1, $a2 ); +} catch (\Error $e) { + echo $e->getMessage() . " on line " . $e->getLine() . "\n"; +} unset( $a1, $a2 ); $x = 'foo'; @@ -30,5 +34,5 @@ $a1 = array_merge_recursive( $a1, $a2 ); unset( $a1, $a2 ); ?> ---EXPECTF-- -Warning: array_merge_recursive(): recursion detected in %s on line 18 +--EXPECT-- +Recursion detected on line 19 diff --git a/ext/standard/tests/array/bug43495.phpt b/ext/standard/tests/array/bug43495.phpt index 522ff1903b..cb011d3d44 100644 --- a/ext/standard/tests/array/bug43495.phpt +++ b/ext/standard/tests/array/bug43495.phpt @@ -8,14 +8,21 @@ $a["key1"]["key2"]["key3"]=&$a; $b=array("key1"=>array("key2"=>array())); $b["key1"]["key2"]["key3"]=&$b; -array_merge_recursive($a,$b); + +try { + array_merge_recursive($a,$b); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} /* Break recursion */ $a["key1"]["key2"]["key3"] = null; $b["key1"]["key2"]["key3"] = null; -echo "Done.\n"; ?> ---EXPECTF-- -Warning: array_merge_recursive(): recursion detected in %sbug43495.php on line %d -Done. + +DONE +--EXPECT-- +Recursion detected + +DONE diff --git a/ext/standard/tests/array/bug65251.phpt b/ext/standard/tests/array/bug65251.phpt index 014517794c..3e0f3a1e27 100644 --- a/ext/standard/tests/array/bug65251.phpt +++ b/ext/standard/tests/array/bug65251.phpt @@ -3,8 +3,12 @@ Bug #65251: array_merge_recursive() recursion detection broken --FILE-- <?php -array_merge_recursive($GLOBALS, $GLOBALS) +try { + array_merge_recursive($GLOBALS, $GLOBALS); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> ---EXPECTF-- -Warning: array_merge_recursive(): recursion detected in %s on line %d +--EXPECT-- +Recursion detected diff --git a/ext/standard/tests/array/bug67693.phpt b/ext/standard/tests/array/bug67693.phpt index 516436c511..c9aa2d86fa 100644 --- a/ext/standard/tests/array/bug67693.phpt +++ b/ext/standard/tests/array/bug67693.phpt @@ -16,9 +16,9 @@ echo"\nDone"; ?> --EXPECT-- array(2) { - [0]=> + [-1]=> int(0) - [1]=> + [0]=> int(0) } diff --git a/ext/standard/tests/array/bug70713.phpt b/ext/standard/tests/array/bug70713.phpt index 7cd0a0f113..f24720607d 100644 --- a/ext/standard/tests/array/bug70713.phpt +++ b/ext/standard/tests/array/bug70713.phpt @@ -19,8 +19,13 @@ class obj } $arr = array('string' => new obj); -array_walk_recursive($arr, 'settype'); + +try { + array_walk_recursive($arr, 'settype'); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} ?> ---EXPECTF-- -Warning: array_walk_recursive(): Iterated value is no longer an array or object in %s on line %d +--EXPECT-- +Iterated value is no longer an array or object diff --git a/ext/standard/tests/array/bug71220.phpt b/ext/standard/tests/array/bug71220.phpt index 49e5bb7719..ed46b25e18 100644 --- a/ext/standard/tests/array/bug71220.phpt +++ b/ext/standard/tests/array/bug71220.phpt @@ -3,8 +3,14 @@ Bug #71220 (Null pointer deref (segfault) in compact via ob_start) --FILE-- <?php ob_start("compact"); -ob_end_clean(); +try { + ob_end_clean(); +} catch (\Error $e) { + echo $e->getMessage(); +} ?> -okey + +OKAY --EXPECT-- -okey +Cannot call compact() dynamically +OKAY diff --git a/ext/standard/tests/array/bug77395.phpt b/ext/standard/tests/array/bug77395.phpt index 7910e36982..b90e9dd976 100644 --- a/ext/standard/tests/array/bug77395.phpt +++ b/ext/standard/tests/array/bug77395.phpt @@ -10,7 +10,12 @@ function error_handle($level, $message, $file = '', $line = 0){ } set_error_handler('error_handle'); $data = [['aa'=> 'bb',], ['aa'=> 'bb',],]; -array_multisort(array_column($data, 'bb'),SORT_DESC, $data); // PHP Warning error + +try { + array_multisort(array_column($data, 'bb'),SORT_DESC, $data); // PHP Warning error +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> --EXPECT-- -array_multisort(): Array sizes are inconsistent +Array sizes are inconsistent diff --git a/ext/standard/tests/array/bug77931.phpt b/ext/standard/tests/array/bug77931.phpt index 98a2eb91cf..45a241f27f 100644 --- a/ext/standard/tests/array/bug77931.phpt +++ b/ext/standard/tests/array/bug77931.phpt @@ -3,14 +3,24 @@ Bug #77931: Warning for array_map mentions wrong type --FILE-- <?php -array_map('trim', array(), 1); -array_map('trim', array(), array(), true); -array_map('trim', array(), array(), array(), null); +try { + array_map('trim', array(), 1); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + array_map('trim', array(), array(), true); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + array_map('trim', array(), array(), array(), null); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: array_map(): Expected parameter 3 to be an array, int given in %s on line %d - -Warning: array_map(): Expected parameter 4 to be an array, bool given in %s on line %d - -Warning: array_map(): Expected parameter 5 to be an array, null given in %s on line %d +--EXPECT-- +Expected parameter 3 to be an array, int given +Expected parameter 4 to be an array, bool given +Expected parameter 5 to be an array, null given diff --git a/ext/standard/tests/array/compact_variation1.phpt b/ext/standard/tests/array/compact_variation1.phpt index d2b9fc45df..9201bc5aa1 100644 --- a/ext/standard/tests/array/compact_variation1.phpt +++ b/ext/standard/tests/array/compact_variation1.phpt @@ -10,7 +10,7 @@ Test compact() function : usage variations - arrays containing references. /* * compact variations - arrays with references */ -echo "*** Testing compact() : usage variations - arrays containg references ***\n"; +echo "*** Testing compact() : usage variations - arrays containing references ***\n"; $a = 1; $b = 2; $c = 3; @@ -20,31 +20,34 @@ $arr2 = array("a", array(array(array("b")))); $arr2[1][0][0][] = &$arr2; $arr2[1][0][0][] = &$arr2[1]; $arr3 = array(&$string); -var_dump(compact($arr1)); -var_dump(compact($arr2)); -var_dump(compact($arr3)); -echo "Done"; -?> ---EXPECTF-- -*** Testing compact() : usage variations - arrays containg references *** -Warning: compact(): recursion detected in %s on line %d -array(1) { - ["a"]=> - int(1) +try { + var_dump(compact($arr1)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; } -Warning: compact(): recursion detected in %s on line %d +try { + var_dump(compact($arr2)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -Warning: compact(): recursion detected in %s on line %d -array(2) { - ["a"]=> - int(1) - ["b"]=> - int(2) +try { + var_dump(compact($arr3)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; } +?> + +DONE +--EXPECT-- +*** Testing compact() : usage variations - arrays containing references *** +Recursion detected +Recursion detected array(1) { ["c"]=> int(3) } -Done + +DONE diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt index 175cfe7118..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,22 +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: Use of undefined constant ABCD - assumed 'ABCD' (this will throw an Error in a future version of PHP) in %s on line %d - -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/each.phpt b/ext/standard/tests/array/each.phpt Binary files differdeleted file mode 100644 index 4af2097a7d..0000000000 --- a/ext/standard/tests/array/each.phpt +++ /dev/null diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt deleted file mode 100644 index cd38682dc7..0000000000 --- a/ext/standard/tests/array/each_basic.phpt +++ /dev/null @@ -1,76 +0,0 @@ ---TEST-- -Test each() function : basic functionality ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test basic functionality of each() - */ - -echo "*** Testing each() : basic functionality ***\n"; - -$arr = array ('one' => 1, 'zero', 'two' => 'deux', 20 => 'twenty'); -echo "\n-- Passed array: --\n"; -var_dump($arr); - -echo "\n-- Initial position: --\n"; -var_dump(each($arr)); - -echo "\n-- End position: --\n"; -end($arr); -var_dump(each($arr)); - -echo "\n-- Passed the end of array: --\n"; -var_dump(each($arr)); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : basic functionality *** - --- Passed array: -- -array(4) { - ["one"]=> - int(1) - [0]=> - string(4) "zero" - ["two"]=> - string(4) "deux" - [20]=> - string(6) "twenty" -} - --- Initial position: -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - int(1) - ["value"]=> - int(1) - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} - --- End position: -- -array(4) { - [1]=> - string(6) "twenty" - ["value"]=> - string(6) "twenty" - [0]=> - int(20) - ["key"]=> - int(20) -} - --- Passed the end of array: -- -bool(false) -Done diff --git a/ext/standard/tests/array/each_error.phpt b/ext/standard/tests/array/each_error.phpt deleted file mode 100644 index e7ee4976ed..0000000000 --- a/ext/standard/tests/array/each_error.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Test each() function : error conditions - pass incorrect number of args ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass an incorrect number of arguments to each() to test behaviour - */ - -echo "*** Testing each() : error conditions ***\n"; - -// Zero arguments -echo "\n-- Testing each() function with Zero arguments --\n"; -var_dump( each() ); - -//Test each with one more than the expected number of arguments -echo "\n-- Testing each() function with more than expected no. of arguments --\n"; -$arr = array(1, 2); -$extra_arg = 10; -var_dump( each($arr, $extra_arg) ); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : error conditions *** - --- Testing each() function with Zero arguments -- - -Warning: each() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing each() function with more than expected no. of arguments -- - -Warning: each() expects exactly 1 parameter, 2 given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/each_variation1.phpt b/ext/standard/tests/array/each_variation1.phpt deleted file mode 100644 index 6b75d5e15c..0000000000 --- a/ext/standard/tests/array/each_variation1.phpt +++ /dev/null @@ -1,223 +0,0 @@ ---TEST-- -Test each() function : usage variations - Pass different data types as $arr arg ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass different data types as $arr arg to each() to test behaviour - */ - -echo "*** Testing each() : usage variations ***\n"; - -//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 $arr 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 each() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( each($input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1 -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 2 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 3 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 4 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 5 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 6 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 7 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 8 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 9 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 10 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 11 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 12 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 13 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 14 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 15 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 16 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 17 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 18 -- -bool(false) - --- Iteration 19 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 20 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 21 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 22 -- -bool(false) - --- Iteration 23 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 24 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 25 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt deleted file mode 100644 index 34eeedc9a8..0000000000 --- a/ext/standard/tests/array/each_variation2.phpt +++ /dev/null @@ -1,249 +0,0 @@ ---TEST-- -Test each() function : usage variations - arrays of different data types ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass arrays of different data types as $arr argument to each() to test behaviour - */ - -echo "*** Testing each() : usage variations ***\n"; - -//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"); - -// arrays of different data types to be passed as $arr -$inputs = array( - - // int data -/*1*/ 'int' => array( - 0, - 1, - 12345, - -2345, - ), - - // float data -/*2*/ 'float' => array( - 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - ), - - // null data -/*3*/ 'null' => array( - NULL, - null, - ), - - // boolean data -/*4*/ 'bool' => array( - true, - false, - TRUE, - FALSE, - ), - - // empty data -/*5*/ 'empty string' => array( - "", - '', - ), - -/*6*/ 'empty array' => array( - ), - - // string data -/*7*/ 'string' => array( - "string", - 'string', - $heredoc, - ), - - // object data -/*8*/ 'object' => array( - new classA(), - ), - - // undefined data -/*9*/ 'undefined' => array( - @$undefined_var, - ), - - // unset data -/*10*/ 'unset' => array( - @$unset_var, - ), - - // resource variable -/*11*/ 'resource' => array( - $fp - ), -); - -// loop through each element of $inputs to check the behavior of each() -$iterator = 1; -foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator: $key data --\n"; - var_dump( each($input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1: int data -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - int(0) - ["value"]=> - int(0) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 2: float data -- -array(4) { - [1]=> - float(10.5) - ["value"]=> - float(10.5) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 3: null data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 4: bool data -- -array(4) { - [1]=> - bool(true) - ["value"]=> - bool(true) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 5: empty string data -- -array(4) { - [1]=> - string(0) "" - ["value"]=> - string(0) "" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 6: empty array data -- -bool(false) - --- Iteration 7: string data -- -array(4) { - [1]=> - string(6) "string" - ["value"]=> - string(6) "string" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 8: object data -- -array(4) { - [1]=> - object(classA)#%d (0) { - } - ["value"]=> - object(classA)#%d (0) { - } - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 9: undefined data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 10: unset data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 11: resource data -- -array(4) { - [1]=> - resource(%d) of type (stream) - ["value"]=> - resource(%d) of type (stream) - [0]=> - int(0) - ["key"]=> - int(0) -} -Done diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt deleted file mode 100644 index 32342d6d78..0000000000 --- a/ext/standard/tests/array/each_variation3.phpt +++ /dev/null @@ -1,254 +0,0 @@ ---TEST-- -Test each() function : usage variations - keys of different data types ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass each() arrays where the keys are different data types to test behaviour - */ - -echo "*** Testing each() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// unexpected values to be passed as $arr -$inputs = array( - - // int data -/*1*/ 'int' => array( - 0 => 'zero', - 1 => 'one', - 12345 => 'positive', - -2345 => 'negative', - ), - - // float data -/*2*/ 'float' => array( - 10.5 => 'positive', - -10.5 => 'negative', - .5 => 'half', - ), - -/*3*/ 'extreme floats' => array( - 12.3456789000e6 => 'large', - 12.3456789000E-10 => 'small', - ), - - // null data -/*4*/ 'null uppercase' => array( - NULL => 'null 1', - ), - -/*5*/ 'null lowercase' => array( - null => 'null 2', - ), - - // boolean data -/*6*/ 'bool lowercase' => array( - true => 'lowert', - false => 'lowerf', - ), - -/*7*/ 'bool uppercase' => array( - TRUE => 'uppert', - FALSE => 'upperf', - ), - - // empty data -/*8*/ 'empty double quotes' => array( - "" => 'emptyd', - ), - -/*9*/ 'empty single quotes' => array( - '' => 'emptys', - ), - - // string data -/*10*/ 'string' => array( - "stringd" => 'stringd', - 'strings' => 'strings', - $heredoc => 'stringh', - ), - - // undefined data -/*11*/ 'undefined' => array( - @$undefined_var => 'undefined', - ), - - // unset data -/*12*/ 'unset' => array( - @$unset_var => 'unset', - ), -); - -// loop through each element of $inputs to check the behavior of each() -$iterator = 1; -foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator: $key data --\n"; - var_dump( each($input) ); - $iterator++; -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1: int data -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 2: float data -- -array(4) { - [1]=> - string(8) "positive" - ["value"]=> - string(8) "positive" - [0]=> - int(10) - ["key"]=> - int(10) -} - --- Iteration 3: extreme floats data -- -array(4) { - [1]=> - string(5) "large" - ["value"]=> - string(5) "large" - [0]=> - int(12345678) - ["key"]=> - int(12345678) -} - --- Iteration 4: null uppercase data -- -array(4) { - [1]=> - string(6) "null 1" - ["value"]=> - string(6) "null 1" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 5: null lowercase data -- -array(4) { - [1]=> - string(6) "null 2" - ["value"]=> - string(6) "null 2" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 6: bool lowercase data -- -array(4) { - [1]=> - string(6) "lowert" - ["value"]=> - string(6) "lowert" - [0]=> - int(1) - ["key"]=> - int(1) -} - --- Iteration 7: bool uppercase data -- -array(4) { - [1]=> - string(6) "uppert" - ["value"]=> - string(6) "uppert" - [0]=> - int(1) - ["key"]=> - int(1) -} - --- Iteration 8: empty double quotes data -- -array(4) { - [1]=> - string(6) "emptyd" - ["value"]=> - string(6) "emptyd" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 9: empty single quotes data -- -array(4) { - [1]=> - string(6) "emptys" - ["value"]=> - string(6) "emptys" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 10: string data -- -array(4) { - [1]=> - string(7) "stringd" - ["value"]=> - string(7) "stringd" - [0]=> - string(7) "stringd" - ["key"]=> - string(7) "stringd" -} - --- Iteration 11: undefined data -- -array(4) { - [1]=> - string(9) "undefined" - ["value"]=> - string(9) "undefined" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 12: unset data -- -array(4) { - [1]=> - string(5) "unset" - ["value"]=> - string(5) "unset" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} -Done diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt deleted file mode 100644 index 64fbb4a8d0..0000000000 --- a/ext/standard/tests/array/each_variation4.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -Test each() function : usage variations - Referenced variables ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test behaviour of each() when: - * 1. Passed an array made up of referenced variables - * 2. Passed an array as $arr argument by reference - */ - -echo "*** Testing each() : usage variations ***\n"; - -echo "\n-- Array made up of referenced variables: --\n"; -$val1 = 'foo'; -$val2 = 'bar'; - -$arr1 = array('one' => &$val1, &$val2); - -echo "-- Call each until at the end of the array: --\n"; -var_dump( each($arr1) ); -var_dump( each($arr1) ); -var_dump( each($arr1) ); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Array made up of referenced variables: -- --- Call each until at the end of the array: -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(3) "foo" - ["value"]=> - string(3) "foo" - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} -array(4) { - [1]=> - string(3) "bar" - ["value"]=> - string(3) "bar" - [0]=> - int(0) - ["key"]=> - int(0) -} -bool(false) -Done diff --git a/ext/standard/tests/array/each_variation5.phpt b/ext/standard/tests/array/each_variation5.phpt deleted file mode 100644 index 441882f962..0000000000 --- a/ext/standard/tests/array/each_variation5.phpt +++ /dev/null @@ -1,97 +0,0 @@ ---TEST-- -Test each() function : usage variations - Multi-dimensional arrays ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test behaviour of each() when passed: - * 1. a two-dimensional array - * 2. a sub-array - */ - -echo "*** Testing each() : usage variations ***\n"; - -$arr = array ('zero', - array(1, 2, 3), - 'one' => 'un', - array('a', 'b', 'c') - ); - -echo "\n-- Pass each() a two-dimensional array --\n"; -for ($i = 1; $i < count($arr); $i++) { - var_dump( each($arr) ); -} - -echo "\n-- Pass each() a sub-array --\n"; -var_dump( each($arr[2])); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Pass each() a two-dimensional array -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} -array(4) { - [1]=> - array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - } - ["value"]=> - array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - } - [0]=> - int(1) - ["key"]=> - int(1) -} -array(4) { - [1]=> - string(2) "un" - ["value"]=> - string(2) "un" - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} - --- Pass each() a sub-array -- -array(4) { - [1]=> - string(1) "a" - ["value"]=> - string(1) "a" - [0]=> - int(0) - ["key"]=> - int(0) -} -Done diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt deleted file mode 100644 index de52ba5965..0000000000 --- a/ext/standard/tests/array/each_variation6.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -Test each() function : usage variations - Internal array pointer ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test the position of the internal array pointer after a call to each() - */ - -echo "*** Testing each() : usage variations ***\n"; - -$arr = array('zero', 'one', 'two', 'abc', 'xyz'); - -echo "\n-- Current position: --\n"; -echo key($arr) . " => " . current($arr) . "\n"; - -echo "\n-- Call to each(): --\n"; -var_dump( each($arr) ); - -echo "\n-- New position: --\n"; -echo key($arr) . " => " . current($arr) . "\n"; - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Current position: -- -0 => zero - --- Call to each(): -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- New position: -- -1 => one -Done diff --git a/ext/standard/tests/array/end.phpt b/ext/standard/tests/array/end.phpt index 724f2e612f..a7474a7e73 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 0049041848..ba20693d0f 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..2103a1b9a4 100644 --- a/ext/standard/tests/array/extract_error.phpt +++ b/ext/standard/tests/array/extract_error.phpt @@ -6,53 +6,35 @@ 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) ); +try { + var_dump( extract($arr, -1 . "wddr") ); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -/* More than valid number of arguments i.e. 3 args */ -var_dump( extract($arr, EXTR_SKIP, "aa", "ee") ); +try { + var_dump( extract($arr, 7 , "wddr") ); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} /* Two Arguments, second as prefix but without prefix string as third argument */ -var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) ); +try { + var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) ); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} 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 -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 +Invalid extract type +Invalid extract type +Specified extract type requires the prefix parameter Done diff --git a/ext/standard/tests/array/extract_error_variation1.phpt b/ext/standard/tests/array/extract_error_variation1.phpt new file mode 100644 index 0000000000..ec3078a0b9 --- /dev/null +++ b/ext/standard/tests/array/extract_error_variation1.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test extract() function - error condition - Invalid prefix. +--FILE-- +<?php +$a = ["1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five"]; + +try { + extract($a, EXTR_PREFIX_ALL, '85bogus'); +} catch (\Error $e) { + echo $e->getMessage(); +} +?> +--EXPECT-- +Prefix is not a valid identifier 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..9e6448cd52 100644 --- a/ext/standard/tests/array/max.phpt +++ b/ext/standard/tests/array/max.phpt @@ -5,10 +5,24 @@ precision=14 --FILE-- <?php -var_dump(max()); -var_dump(max(1)); -var_dump(max(array())); -var_dump(max(new stdclass)); +try { + var_dump(max(1)); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(max(array())); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(max(new stdclass)); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} + var_dump(max(2,1,2)); var_dump(max(2.1,2.11,2.09)); var_dump(max("", "t", "b")); @@ -19,18 +33,10 @@ 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 -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 -bool(false) - -Warning: max(): When only one parameter is given, it must be an array in %s on line 6 -NULL +--EXPECT-- +When only one parameter is given, it must be an array +Array must contain at least one element +When only one parameter is given, it must be an array int(2) float(2.11) string(1) "t" diff --git a/ext/standard/tests/array/min.phpt b/ext/standard/tests/array/min.phpt index cb8c7cfdca..85defa6e85 100644 --- a/ext/standard/tests/array/min.phpt +++ b/ext/standard/tests/array/min.phpt @@ -5,10 +5,24 @@ precision=14 --FILE-- <?php -var_dump(min()); -var_dump(min(1)); -var_dump(min(array())); -var_dump(min(new stdclass)); +try { + var_dump(min(1)); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(min(array())); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(min(new stdclass)); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} + var_dump(min(2,1,2)); var_dump(min(2.1,2.11,2.09)); var_dump(min("", "t", "b")); @@ -19,18 +33,10 @@ 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 -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 -bool(false) - -Warning: min(): When only one parameter is given, it must be an array in %s on line 6 -NULL +--EXPECT-- +When only one parameter is given, it must be an array +Array must contain at least one element +When only one parameter is given, it must be an array int(1) float(2.09) string(0) "" diff --git a/ext/standard/tests/array/negative_index.phpt b/ext/standard/tests/array/negative_index.phpt new file mode 100644 index 0000000000..a9f442acbd --- /dev/null +++ b/ext/standard/tests/array/negative_index.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test arrays starting with negative indices +--FILE-- +<?php + +$a = array_fill(-2, 3, true); +$b = [-2 => true, true, true]; +$c = ["string" => true, -2 => true, true, true]; +unset($c["string"]); +$d[-2] = true; +$d[] = true; +$d[] = true; +$e = [-2 => false]; +array_pop($e); +$e[] = true; +$e[] = true; +$e[] = true; + +var_dump($a === $b && $b === $c && $c === $d && $d == $e); +var_dump($a); +?> +--EXPECT-- +bool(true) +array(3) { + [-2]=> + bool(true) + [-1]=> + bool(true) + [0]=> + bool(true) +} diff --git a/ext/standard/tests/array/range_bug70239_0.phpt b/ext/standard/tests/array/range_bug70239_0.phpt index edfdd05fbc..c902a168b2 100644 --- a/ext/standard/tests/array/range_bug70239_0.phpt +++ b/ext/standard/tests/array/range_bug70239_0.phpt @@ -2,9 +2,13 @@ Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 1 --FILE-- <?php -range(0, pow(2.0, 100000000)); +try { + range(0, pow(2.0, 100000000)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> ===DONE=== ---EXPECTF-- -Warning: range(): Invalid range supplied: start=0 end=inf in %srange_bug70239_0.php on line %d +--EXPECT-- +Invalid range supplied: start=0 end=inf ===DONE=== diff --git a/ext/standard/tests/array/range_bug70239_1.phpt b/ext/standard/tests/array/range_bug70239_1.phpt index 75419cf829..6d12348f67 100644 --- a/ext/standard/tests/array/range_bug70239_1.phpt +++ b/ext/standard/tests/array/range_bug70239_1.phpt @@ -2,9 +2,13 @@ Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 2 --FILE-- <?php -range(pow(2.0, 100000000), pow(2.0, 100000000) + 1); +try { + range(pow(2.0, 100000000), pow(2.0, 100000000) + 1); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> ===DONE=== ---EXPECTF-- -Warning: range(): Invalid range supplied: start=inf end=inf in %srange_bug70239_1.php on line %d +--EXPECT-- +Invalid range supplied: start=inf end=inf ===DONE=== diff --git a/ext/standard/tests/array/range_bug70239_2.phpt b/ext/standard/tests/array/range_bug70239_2.phpt index 76ed638669..c9396b3cb4 100644 --- a/ext/standard/tests/array/range_bug70239_2.phpt +++ b/ext/standard/tests/array/range_bug70239_2.phpt @@ -2,10 +2,13 @@ Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 3 --FILE-- <?php -var_dump(range(0, PHP_INT_MAX)); +try { + var_dump(range(0, PHP_INT_MAX)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> ===DONE=== --EXPECTF-- -Warning: range(): The supplied range exceeds the maximum array size: start=0 end=%d in %srange_bug70239_2.php on line %d -bool(false) +The supplied range exceeds the maximum array size: start=0 end=%d ===DONE=== diff --git a/ext/standard/tests/array/range_bug70239_3.phpt b/ext/standard/tests/array/range_bug70239_3.phpt index 8402870c82..e49267bfe3 100644 --- a/ext/standard/tests/array/range_bug70239_3.phpt +++ b/ext/standard/tests/array/range_bug70239_3.phpt @@ -2,10 +2,13 @@ Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 4 --FILE-- <?php -var_dump(range(PHP_INT_MIN, 0)); +try { + var_dump(range(PHP_INT_MIN, 0)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> ===DONE=== --EXPECTF-- -Warning: range(): The supplied range exceeds the maximum array size: start=-%d end=0 in %srange_bug70239_3.php on line %d -bool(false) +The supplied range exceeds the maximum array size: start=-%d end=0 ===DONE=== diff --git a/ext/standard/tests/array/range_errors.phpt b/ext/standard/tests/array/range_errors.phpt index b63e9874bf..971eade4be 100644 --- a/ext/standard/tests/array/range_errors.phpt +++ b/ext/standard/tests/array/range_errors.phpt @@ -7,34 +7,84 @@ precision=14 echo "\n*** Testing error conditions ***\n"; -echo "\n-- Testing ( (low < high) && (step = 0) ) --"; -var_dump( range(1, 2, 0) ); -var_dump( range("a", "b", 0) ); - -echo "\n\n-- Testing ( (low > high) && (step = 0) ) --"; -var_dump( range(2, 1, 0) ); -var_dump( range("b", "a", 0) ); - -echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --"; -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 -var_dump( range(-1, -2, 2) ); -var_dump( range("a", "j", "z") ); -var_dump( range(0, 1, "140962482048819216326.24") ); -var_dump( range(0, 1, "140962482048819216326.24.") ); - -echo "\n-- Testing Invalid steps --"; +echo "\n-- Testing ( (low < high) && (step = 0) ) --\n"; +try { + var_dump( range(1, 2, 0) ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +try { + var_dump( range("a", "b", 0) ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +echo "\n\n-- Testing ( (low > high) && (step = 0) ) --\n"; +try { + var_dump( range(2, 1, 0) ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +try { + var_dump( range("b", "a", 0) ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --\n"; +try { + var_dump( range(1.0, 7.0, 6.5) ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --\n"; +try { + var_dump( range(7.0, 1.0, 6.5) ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +echo "\n-- Testing other conditions --\n"; +try { + var_dump( range(-1, -2, 2) ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +try { + var_dump( range("a", "j", "z") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +try { + var_dump( range(0, 1, "140962482048819216326.24") ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +try { + var_dump( range(0, 1, "140962482048819216326.24.") ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +echo "\n-- Testing Invalid steps --\n"; $step_arr = array( "string", NULL, FALSE, "", "\0" ); foreach( $step_arr as $step ) { - var_dump( range( 1, 5, $step ) ); + try { + var_dump( range( 1, 5, $step ) ); + } catch (\TypeError $e) { + echo $e->getMessage(), "\n"; + } catch (\Error $e) { + echo $e->getMessage(), "\n"; + } } echo "Done\n"; @@ -43,65 +93,34 @@ echo "Done\n"; *** Testing error conditions *** -- Testing ( (low < high) && (step = 0) ) -- -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) - -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) +step exceeds the specified range +step exceeds the specified range -- Testing ( (low > high) && (step = 0) ) -- -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) - -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) +step exceeds the specified range +step exceeds the specified range -- Testing ( (low < high) && (high-low < step) ) -- -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) +step exceeds the specified range -- Testing ( (low > high) && (low-high < step) ) -- -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) +step exceeds the specified range -Warning: range() expects at most 3 parameters, 4 given in %s on line %d -bool(false) +-- Testing other conditions -- +step exceeds the specified range +range() expects parameter 3 to be int or float, string given +step exceeds the specified range -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) - -Warning: range(): Invalid range string - must be numeric in %s on line %d -bool(false) - -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) - -Warning: range(): Invalid range string - must be numeric in %s on line %d -bool(false) +Notice: A non well formed numeric value encountered in %s on line %d +step exceeds the specified range -- Testing Invalid steps -- -Warning: range(): Invalid range string - must be numeric in %s on line %d -bool(false) - -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) - -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) - -Warning: range(): Invalid range string - must be numeric in %s on line %d -bool(false) - -Warning: range(): Invalid range string - must be numeric in %s on line %d -bool(false) +range() expects parameter 3 to be int or float, string given +step exceeds the specified range +step exceeds the specified range +range() expects parameter 3 to be int or float, string given +range() expects parameter 3 to be int or float, string given Done diff --git a/ext/standard/tests/array/range_variation.phpt b/ext/standard/tests/array/range_variation.phpt index f7fc9e0815..3de5f6188f 100644 --- a/ext/standard/tests/array/range_variation.phpt +++ b/ext/standard/tests/array/range_variation.phpt @@ -18,7 +18,11 @@ for( $i = 0; $i < count($low_arr); $i++) { echo "\n*** Possible variatins with steps ***\n"; var_dump( range( 1, 5, TRUE ) ); -var_dump( range( 1, 5, array(1, 2) ) ); +try { + var_dump( range( 1, 5, array(1, 2) ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -611,16 +615,5 @@ array(5) { [4]=> int(5) } -array(5) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - [3]=> - int(4) - [4]=> - int(5) -} +range() expects parameter 3 to be int or float, array given Done 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=== |
