From: Ant Phillips Date: Tue, 2 Dec 2008 13:32:53 +0000 (+0000) Subject: Array tests: checked on PHP 5.2.6, 5.3 and 6.0 (Windows, Linux and Linux 64 bit). X-Git-Tag: php-5.3.0alpha2~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b1a411806c7b0e5692d5472e4f1da4b002b330e;p=php Array tests: checked on PHP 5.2.6, 5.3 and 6.0 (Windows, Linux and Linux 64 bit). --- diff --git a/ext/standard/tests/array/array_count_values_error.phpt b/ext/standard/tests/array/array_count_values_error.phpt new file mode 100644 index 0000000000..843e34ee59 --- /dev/null +++ b/ext/standard/tests/array/array_count_values_error.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test array_count_values() function : Invalid parameters +--FILE-- + +--EXPECTF-- +*** Testing array_count_values() : error conditions *** + +-- Testing array_count_values() function with Zero arguments -- + +Warning: array_count_values() expects exactly 1 parameter, 0 given in %sarray_count_values_error.php on line 16 +NULL + +-- Testing array_count_values() function with more than expected no. of arguments -- + +Warning: array_count_values() expects exactly 1 parameter, 2 given in %sarray_count_values_error.php on line 22 +NULL + +-- Testing array_count_values() function integer arguments -- + +Warning: array_count_values() expects parameter 1 to be array, integer given in %sarray_count_values_error.php on line 26 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_count_values_variation.phpt b/ext/standard/tests/array/array_count_values_variation.phpt new file mode 100644 index 0000000000..efd3c81cc2 --- /dev/null +++ b/ext/standard/tests/array/array_count_values_variation.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test array_count_values() function : Test all normal paramter variations +--FILE-- + "bobv", "val", 6 => "val6", $fp, $ob); + +var_dump (@array_count_values ($arrays)); +echo "\n"; + + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_count_values() : parameter variations *** +array(3) { + ["bobv"]=> + int(1) + ["val"]=> + int(1) + ["val6"]=> + int(1) +} + +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_uassoc_variation14.phpt b/ext/standard/tests/array/array_diff_uassoc_variation14.phpt new file mode 100644 index 0000000000..a98a2800da --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_variation14.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test array_diff_uassoc() function : usage variation -Passing classWithoutToString (handling fatal error) to callback +--FILE-- + "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); + +class classWithoutToString +{ +} + +// Define error handler +function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { + if (error_reporting() != 0) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } +} +set_error_handler('test_error_handler'); + +$value = new classWithoutToString(); +var_dump( array_diff_uassoc($array1, $array2, $value) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_uassoc() : usage variation *** +Error: 2 - array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given, %s(%d) +NULL +===DONE=== + diff --git a/ext/standard/tests/array/array_diff_ukey_variation11.phpt b/ext/standard/tests/array/array_diff_ukey_variation11.phpt new file mode 100644 index 0000000000..4882e729b5 --- /dev/null +++ b/ext/standard/tests/array/array_diff_ukey_variation11.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test array_diff_ukey() function : usage variation - Passing class without string to callback (Handling fatal error) +--SKIPIF-- + +--FILE-- + 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array2 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array3 = array(1, 2, 3, 4, 5); + +// Define error handler +function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { + if (error_reporting() != 0) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } +} +set_error_handler('test_error_handler'); + + +class classWithoutToString +{ +} + +$value = new classWithoutToString(); + +var_dump( array_diff_ukey($array1, $array2, $value) ); +var_dump( array_diff_ukey($array1, $array2, $array3, $value) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_ukey() : usage variation *** +Error: 4096 - Object of class classWithoutToString could not be converted to string, %s(%d) +Error: 2 - array_diff_ukey(): Not a valid callback , %s(%d) +NULL +Error: 4096 - Object of class classWithoutToString could not be converted to string, %s(%d) +Error: 2 - array_diff_ukey(): Not a valid callback , %s(%d) +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_fill_keys_error.phpt b/ext/standard/tests/array/array_fill_keys_error.phpt new file mode 100644 index 0000000000..64fd0e528e --- /dev/null +++ b/ext/standard/tests/array/array_fill_keys_error.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test array_fill_keys() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_fill_keys() : error conditions *** + +-- Testing array_fill_keys() function with more than expected no. of arguments -- + +Warning: array_fill_keys() expects exactly 2 parameters, 3 given in %sarray_fill_keys_error.php on line %d +NULL + +-- Testing array_fill_keys() function with less than expected no. of arguments -- + +Warning: array_fill_keys() expects exactly 2 parameters, 1 given in %sarray_fill_keys_error.php on line %d +NULL + +-- Testing array_fill_keys() function with no argumets -- + +Warning: array_fill_keys() expects exactly 2 parameters, 0 given in %sarray_fill_keys_error.php on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_fill_keys_variation1.phpt b/ext/standard/tests/array/array_fill_keys_variation1.phpt new file mode 100644 index 0000000000..9fab89d7f2 --- /dev/null +++ b/ext/standard/tests/array/array_fill_keys_variation1.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test array_fill_keys() function : variation of parameter +--FILE-- + 2, "strk1" => "strv1", 4, $simpleStr); +var_dump( array_fill_keys($keyedArray, $simpleStr) ); + +echo "\n-- Testing array_fill_keys() function with mixed array --\n"; +$mixedArray = array($fp, $obj, $simpleStr, $emptyArr, 2, $bool, $float); +var_dump( array_fill_keys($mixedArray, $simpleStr) ); + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing array_fill_keys() : parameter variations *** + +-- Testing array_fill_keys() function with empty arguments -- +array(0) { +} + +-- Testing array_fill_keys() function with keyed array -- +array(4) { + [2]=> + string(6) "simple" + ["strv1"]=> + string(6) "simple" + [4]=> + string(6) "simple" + ["simple"]=> + string(6) "simple" +} + +-- Testing array_fill_keys() function with mixed array -- + +Notice: Array to string conversion in %sarray_fill_keys_variation1.php on line %d +array(7) { + ["Resource id #%d"]=> + string(6) "simple" + ["Class A object"]=> + string(6) "simple" + ["simple"]=> + string(6) "simple" + ["Array"]=> + string(6) "simple" + [2]=> + string(6) "simple" + [""]=> + string(6) "simple" + ["2.4"]=> + string(6) "simple" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_fill_keys_variation2.phpt b/ext/standard/tests/array/array_fill_keys_variation2.phpt new file mode 100644 index 0000000000..4f3681aaf4 --- /dev/null +++ b/ext/standard/tests/array/array_fill_keys_variation2.phpt @@ -0,0 +1,81 @@ +--TEST-- +Test array_fill_keys() function : variation of parameter +--FILE-- + +--EXPECTF-- +*** Testing array_fill_keys() : parameter variations *** + +-- Testing array_fill_keys() function with reference value -- +array(2) { + ["one"]=> + string(6) "simple" + ["two"]=> + string(6) "simple" +} + +-- Testing array_fill_keys() function with reference keys -- +array(2) { + ["one"]=> + string(6) "simple" + ["simple"]=> + string(6) "simple" +} +array(2) { + ["one"]=> + string(6) "simple" + ["simple"]=> + string(6) "simple" +} + +-- Testing array_fill_keys() function with reference array input -- +array(2) { + ["one"]=> + string(3) "bob" + ["two"]=> + string(3) "bob" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_fill_keys_variation3.phpt b/ext/standard/tests/array/array_fill_keys_variation3.phpt new file mode 100644 index 0000000000..5c57823ba7 --- /dev/null +++ b/ext/standard/tests/array/array_fill_keys_variation3.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test array_fill_keys() function : variation of parameter +--FILE-- + +--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, boolean given in %sarray_fill_keys_variation3.php on line %d +NULL + +-- Testing array_fill_keys() function with unusual second arguments -- +array(2) { + ["one"]=> + resource(%d) of type (stream) + ["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 \ No newline at end of file diff --git a/ext/standard/tests/array/array_fill_keys_variation4.phpt b/ext/standard/tests/array/array_fill_keys_variation4.phpt new file mode 100644 index 0000000000..209443db08 --- /dev/null +++ b/ext/standard/tests/array/array_fill_keys_variation4.phpt @@ -0,0 +1,91 @@ +--TEST-- +Test array_fill_keys() function : variation of parameter +--FILE-- + +--EXPECTF-- +*** Testing array_fill_keys() : parameter variations *** + +-- Testing array_fill_keys() function with float -- +array(1) { + ["one"]=> + float(2.4) +} + +-- Testing array_fill_keys() function with null -- +array(1) { + ["one"]=> + NULL +} + +-- Testing array_fill_keys() function with object -- +array(1) { + ["one"]=> + object(classA)#%d (0) { + } +} + +-- Testing array_fill_keys() function with boolean -- +array(1) { + ["one"]=> + bool(false) +} + +-- Testing array_fill_keys() function with resource -- +array(1) { + ["one"]=> + resource(%d) of type (stream) +} + +-- Testing array_fill_keys() function with unset var -- + +Notice: Undefined variable: unset_var in %sarray_fill_keys_variation4.php on line %d +array(1) { + ["one"]=> + NULL +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_assoc_variation5.phpt b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt index b85dd7cee9..7d8e09eb2d 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation5.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt @@ -20,17 +20,6 @@ echo "*** Testing array_intersect_assoc() : assoc array with diff keys to \$arr1 $unset_var = 10; unset ($unset_var); -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// get a class -class classA -{ - public function __toString(){ - return "Class A object"; - } -} - // get a heredoc string $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"), // array with mixed keys -/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, - $fp => 'resource', 133 => "int", 444.432 => "float", +/*11*/ array('hello' => 1, "fruit" => 2.2, + 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); // 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 $arrrays to check the behavior of array_intersect_assoc() $iterator = 1; @@ -88,23 +77,10 @@ foreach($arrays as $arr1) { $iterator++; } -// close the file resource used -fclose($fp); - echo "Done"; ?> --EXPECTF-- *** Testing array_intersect_assoc() : assoc array with diff keys to $arr1 argument *** - -Warning: Illegal offset type in %s on line %d - -Warning: Illegal offset type in %s on line %d - -Warning: Illegal offset type in %s on line %d - -Warning: Illegal offset type 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_intersect_assoc_variation6.phpt b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt index ed96d3276f..75806225ca 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation6.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt @@ -20,17 +20,6 @@ echo "*** Testing array_intersect_assoc() : assoc array with diff keys to \$arr2 $unset_var = 10; unset ($unset_var); -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// get a class -class classA -{ - public function __toString(){ - return "Class A object"; - } -} - // get a heredoc string $heredoc = << 2.2, "pen\n" => 33), array("hello", $heredoc => "string"), // heredoc - // array with object, unset variable and resource variable -/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), + // array with unset variable +/*10*/ array( @$unset_var => "hello"), // array with mixed keys -/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, - $fp => 'resource', 133 => "int", 444.432 => "float", +/*11*/ array('hello' => 1, "fruit" => 2.2, + 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); // array to be passsed to $arr1 argument $arr1 = 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 $arrrays to check the behavior of array_intersect_assoc() $iterator = 1; @@ -88,23 +77,10 @@ foreach($arrays as $arr2) { $iterator++; } -// close the file resource used -fclose($fp); - echo "Done"; ?> --EXPECTF-- *** Testing array_intersect_assoc() : assoc array with diff keys to $arr2 argument *** - -Warning: Illegal offset type in %s on line %d - -Warning: Illegal offset type in %s on line %d - -Warning: Illegal offset type in %s on line %d - -Warning: Illegal offset type 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_intersect_key_variation1.phpt b/ext/standard/tests/array/array_intersect_key_variation1.phpt index c28394ba81..8c245e446b 100644 --- a/ext/standard/tests/array/array_intersect_key_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_key_variation1.phpt @@ -92,7 +92,6 @@ $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) ); diff --git a/ext/standard/tests/array/array_intersect_key_variation2.phpt b/ext/standard/tests/array/array_intersect_key_variation2.phpt index 59b769be66..3c33debebe 100644 --- a/ext/standard/tests/array/array_intersect_key_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_key_variation2.phpt @@ -10,8 +10,8 @@ Test array_intersect_key() function : usage variation - Passing unexpected value 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); -$array3 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array3 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); //get an unset variable $unset_var = 10; @@ -92,6 +92,7 @@ $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) ); diff --git a/ext/standard/tests/array/array_intersect_key_variation4.phpt b/ext/standard/tests/array/array_intersect_key_variation4.phpt index 1223d2153e..1d3d97602c 100644 --- a/ext/standard/tests/array/array_intersect_key_variation4.phpt +++ b/ext/standard/tests/array/array_intersect_key_variation4.phpt @@ -21,7 +21,7 @@ $input_arrays = array( foreach($input_arrays as $key =>$value) { echo "\n--$key--\n"; var_dump( array_intersect_key($input_array, $value) ); - var_dump( array_intersect_key($value, $input_array ) ); + var_dump( array_intersect_key($value,$input_array ) ); } ?> ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation11.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation11.phpt new file mode 100644 index 0000000000..ba3776e202 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_uassoc_variation11.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test array_intersect_uassoc() function : usage variation - Passing class without string to callback (Handling fatal error) +--SKIPIF-- + +--FILE-- + "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); +$array3 = array("a"=>"green", "brown"); +// Define error handler +function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { + if (error_reporting() != 0) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } +} +set_error_handler('test_error_handler'); + + +class classWithoutToString +{ +} + +$value = new classWithoutToString(); + +var_dump( array_intersect_uassoc($array1, $array2, $value) ); +var_dump( array_intersect_uassoc($array1, $array2, $array3, $value) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_uassoc() : usage variation *** +Error: 4096 - Object of class classWithoutToString could not be converted to string, %s(%d) +Error: 2 - array_intersect_uassoc(): Not a valid callback , %s(%d) +NULL +Error: 4096 - Object of class classWithoutToString could not be converted to string, %s(%d) +Error: 2 - array_intersect_uassoc(): Not a valid callback , %s(%d) +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_intersect_ukey_variation10.phpt b/ext/standard/tests/array/array_intersect_ukey_variation10.phpt new file mode 100644 index 0000000000..b080eb2300 --- /dev/null +++ b/ext/standard/tests/array/array_intersect_ukey_variation10.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test array_intersect_ukey() function : usage variation - Passing class without string to callback (Handling fatal error) +--SKIPIF-- + +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array3 = array("a"=>"green", "cyan"); + +// Define error handler +function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { + if (error_reporting() != 0) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } +} +set_error_handler('test_error_handler'); + + +class classWithoutToString +{ +} + +$value = new classWithoutToString(); + +var_dump( array_intersect_ukey($array1, $array2, $value) ); +var_dump( array_intersect_ukey($array1, $array2, $array3, $value) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_intersect_uassoc() : usage variation *** +Error: 4096 - Object of class classWithoutToString could not be converted to string, %s(%d) +Error: 2 - array_intersect_ukey(): Not a valid callback , %s(%d) +NULL +Error: 4096 - Object of class classWithoutToString could not be converted to string, %s(%d) +Error: 2 - array_intersect_ukey(): Not a valid callback , %s(%d) +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_intersect_variation5.phpt b/ext/standard/tests/array/array_intersect_variation5.phpt index 7f36ee3f2e..9aaedeb382 100644 --- a/ext/standard/tests/array/array_intersect_variation5.phpt +++ b/ext/standard/tests/array/array_intersect_variation5.phpt @@ -19,17 +19,6 @@ echo "*** Testing array_intersect() : assoc array with diff keys to \$arr1 argum $unset_var = 10; unset ($unset_var); -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// get a class -class classA -{ - public function __toString(){ - return "Class A object"; - } -} - // get a heredoc string $heredoc = << 2.2, "pen\n" => 33), array("hello", $heredoc => "string"), // heredoc - // array with object, unset variable and resource variable -/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), + // array with unset variable +/*10*/ array( @$unset_var => "hello"), // array with mixed keys -/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, - $fp => 'resource', 133 => "int", 444.432 => "float", +/*11*/ array('hello' => 1, "fruit" => 2.2, + 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); @@ -85,21 +74,10 @@ foreach($arrays as $arr1) { $iterator++; } -// close the file resource used -fclose($fp); - echo "Done"; ?> --EXPECTF-- *** Testing array_intersect() : assoc array with diff keys to $arr1 argument *** - -Warning: Illegal offset type in %s on line %d - -Warning: Illegal offset type in %s on line %d - -Warning: Illegal offset type in %s on line %d - -Warning: Illegal offset type in %s on line %d -- Iterator 1 -- array(0) { } diff --git a/ext/standard/tests/array/array_intersect_variation6.phpt b/ext/standard/tests/array/array_intersect_variation6.phpt index cecde34db8..48d01f7d54 100644 --- a/ext/standard/tests/array/array_intersect_variation6.phpt +++ b/ext/standard/tests/array/array_intersect_variation6.phpt @@ -19,17 +19,6 @@ echo "*** Testing array_intersect() : assoc array with diff keys to \$arr2 argum $unset_var = 10; unset ($unset_var); -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// get a class -class classA -{ - public function __toString(){ - return "Class A object"; - } -} - // get a heredoc string $heredoc = << 2.2, "pen\n" => 33), array("hello", $heredoc => "string"), // heredoc - // array with object, unset variable and resource variable -/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), + // array with unset variable +/*10*/ array( @$unset_var => "hello"), // array with mixed keys -/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, - $fp => 'resource', 133 => "int", 444.432 => "float", +/*11*/ array('hello' => 1, "fruit" => 2.2, + 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); @@ -85,21 +74,10 @@ foreach($arrays as $arr2) { $iterator++; } -// close the file resource used -fclose($fp); - echo "Done"; ?> --EXPECTF-- *** Testing array_intersect() : assoc array with diff keys to $arr2 argument *** - -Warning: Illegal offset type in %s on line %d - -Warning: Illegal offset type in %s on line %d - -Warning: Illegal offset type in %s on line %d - -Warning: Illegal offset type in %s on line %d -- Iterator 1 -- array(0) { } diff --git a/ext/standard/tests/array/array_map_variation19.phpt b/ext/standard/tests/array/array_map_variation19.phpt new file mode 100644 index 0000000000..9478f70eff --- /dev/null +++ b/ext/standard/tests/array/array_map_variation19.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test array_map() function : usage variations - callback pass semantics +--FILE-- + +--EXPECTF-- +array(2) { + [0]=> + string(10) "original.0" + [1]=> + string(10) "original.1" +} +array(2) { + [0]=> + &string(7) "changed" + [1]=> + string(10) "original.1" +} \ No newline at end of file diff --git a/ext/standard/tests/array/array_next_error1.phpt b/ext/standard/tests/array/array_next_error1.phpt new file mode 100644 index 0000000000..72f2cb9f1d --- /dev/null +++ b/ext/standard/tests/array/array_next_error1.phpt @@ -0,0 +1,13 @@ +--TEST-- +next - ensure warning is received when passing an indirect temporary. +--FILE-- + +--EXPECTF-- + +Strict Standards: Only variables should be passed by reference in %s on line %d +int(2) \ No newline at end of file diff --git a/ext/standard/tests/array/array_next_error2.phpt b/ext/standard/tests/array/array_next_error2.phpt new file mode 100644 index 0000000000..d4f16666ef --- /dev/null +++ b/ext/standard/tests/array/array_next_error2.phpt @@ -0,0 +1,12 @@ +--TEST-- +next - ensure we cannot pass a temporary +--FILE-- + +--EXPECTF-- + +Fatal error: Only variables can be passed by reference in %s on line %d \ No newline at end of file diff --git a/ext/standard/tests/array/array_rand_variation4.phpt b/ext/standard/tests/array/array_rand_variation4.phpt index 72b6c55cf3..be4302d33f 100644 --- a/ext/standard/tests/array/array_rand_variation4.phpt +++ b/ext/standard/tests/array/array_rand_variation4.phpt @@ -38,7 +38,7 @@ $asso_arrays = array( // array with special chars as keys /*6*/ array('##' => "key1", '&$r' => 'key2', '!' => "key3", '<>' =>'key4', - "NULL" => 'key5', "\n" => 'newline as key', + "NULL" => 'key5', "\t" => "tab as key", "'" => 'single quote as key', '"' => 'double quote as key', "\0" => "null char as key") ); @@ -165,4 +165,3 @@ array\(2\) { string\([0-9]*\) "[#&!N <\n\t'"\0]*[U#$>]*[rL]*[L]*" } Done - diff --git a/ext/standard/tests/array/array_reduce_error.phpt b/ext/standard/tests/array/array_reduce_error.phpt new file mode 100644 index 0000000000..954aa43d76 --- /dev/null +++ b/ext/standard/tests/array/array_reduce_error.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test array_reduce() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_reduce() : error conditions *** + +-- Testing array_reduce() function with more than expected no. of arguments -- + +Warning: array_reduce() expects at most 3 parameters, 4 given in %sarray_reduce_error.php on line %d +NULL + +-- Testing array_reduce() function with less than expected no. of arguments -- + +Warning: array_reduce() expects at least 2 parameters, 1 given in %sarray_reduce_error.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_reduce_variation1.phpt b/ext/standard/tests/array/array_reduce_variation1.phpt new file mode 100644 index 0000000000..b02a82a7ca --- /dev/null +++ b/ext/standard/tests/array/array_reduce_variation1.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test array_reduce() function : variation +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_reduce() : variation *** + +--- Testing with a callback with too few parameters --- +int(2) + +--- Testing with a callback with too many parameters --- + +Warning: Missing argument 3 for threeArgs() in %sarray_reduce_variation1.php on line %d + +Notice: Undefined variable: x in %sarray_reduce_variation1.php on line %d +int(3) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_reduce_variation2.phpt b/ext/standard/tests/array/array_reduce_variation2.phpt new file mode 100644 index 0000000000..35b2d38f40 --- /dev/null +++ b/ext/standard/tests/array/array_reduce_variation2.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test array_reduce() function : variation - invalid parameters +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_reduce() : variation - invalid parameters *** + +Warning: array_reduce() expects parameter 2 to be a valid callback, function 'bogusbogus' not found or invalid function name in %sarray_reduce_variation2.php on line %d +NULL + +Warning: array_reduce() expects parameter 1 to be array, string given in %sarray_reduce_variation2.php on line %d +NULL + +Warning: array_reduce() expects parameter 1 to be array, object given in %sarray_reduce_variation2.php on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_reduce_variation3.phpt b/ext/standard/tests/array/array_reduce_variation3.phpt new file mode 100644 index 0000000000..f6301026b3 --- /dev/null +++ b/ext/standard/tests/array/array_reduce_variation3.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_reduce() function : variation - object callbacks +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_reduce() : variation - object callbacks *** + +--- Static method callback --- +int(1) + +--- Instance method callback --- +int(1) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_slice_variation1.phpt b/ext/standard/tests/array/array_slice_variation1.phpt index daed1d84fc..4c7a148c88 100644 --- a/ext/standard/tests/array/array_slice_variation1.phpt +++ b/ext/standard/tests/array/array_slice_variation1.phpt @@ -1,61 +1,227 @@ --TEST-- -Test array_slice() - Third parameter (NULL vs 0) +Test array_slice() function : usage variations - Pass different data types as $input arg --FILE-- --EXPECTF-- -array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) -} -array(0) { -} -array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) -} -array(0) { -} -array(0) { -} -array(0) { -} -array(1) { - [0]=> - int(3) -} -array(1) { - [2]=> - int(3) -} -array(0) { -} +*** Testing array_slice() : usage variations *** + +-- Iteration 1 -- + +Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- array(0) { } -string(3) "foo" + +-- Iteration 19 -- + +Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: array_slice() expects parameter 1 to be array, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: array_slice() expects parameter 1 to be array, resource given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_udiff_assoc_error.phpt b/ext/standard/tests/array/array_udiff_assoc_error.phpt new file mode 100644 index 0000000000..ec1cc062ed --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_error.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test array_udiff_assoc() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_udiff_assoc() : error conditions *** + +-- Testing array_udiff_assoc() function with more than expected no. of arguments -- + +Warning: array_udiff_assoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_assoc_error.php on line %d +NULL + +-- Testing array_udiff_assoc() function with less than expected no. of arguments -- + +Warning: array_udiff_assoc(): at least 3 parameters are required, 2 given in %sarray_udiff_assoc_error.php on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_udiff_assoc_variation.phpt b/ext/standard/tests/array/array_udiff_assoc_variation.phpt new file mode 100644 index 0000000000..84e8841b2c --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_variation.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_udiff_assoc() function : variation +--FILE-- + "one", "02" => "two", '3' => "three", "four", "0.5" => 5, 6.0 => 6, "seven" => "0x7"); +$arr2 = array("one" => "one", "02" => "two", '3' => "three"); +$arr3 = array("four", "0.5" => "five", 6 => 6, "seven" => 7); +$arr4 = array("four", "0.5" => "five", 6 => 6, "seven" => 7); + + +var_dump( array_udiff_assoc($arr1, $arr2, $arr3, $arr4, $key_compare_function) ); + + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_assoc() : variation - testing with multiple array arguments *** +array(2) { + [4]=> + string(4) "four" + ["0.5"]=> + int(5) +} +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt new file mode 100644 index 0000000000..9886d73baa --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_udiff_assoc() function : usage variation +--FILE-- + 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 arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_assoc($value, $arr2, $key_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_assoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_assoc(): Argument #1 is not an array in %sarray_udiff_assoc_variation1.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt new file mode 100644 index 0000000000..18484a7ad2 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_udiff_assoc() function : usage variation +--FILE-- + 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 arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_assoc($arr1, $value, $key_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_assoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_assoc(): Argument #2 is not an array in %sarray_udiff_assoc_variation2.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation3.phpt b/ext/standard/tests/array/array_udiff_assoc_variation3.phpt new file mode 100644 index 0000000000..e693afff87 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_variation3.phpt @@ -0,0 +1,251 @@ +--TEST-- +Test array_udiff_assoc() function : usage variation +--FILE-- + 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, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // 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 key_comp_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_assoc($arr1, $arr2, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_assoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--empty array-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--int indexed array-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--associative array-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, first array member is not a valid class name or object in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--nested arrays-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_assoc_variation3.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation4.phpt b/ext/standard/tests/array/array_udiff_assoc_variation4.phpt new file mode 100644 index 0000000000..0bf3e2dbbe --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_variation4.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_udiff_assoc() function : usage variation +--FILE-- + 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(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_assoc(): Argument #3 is not an array in %sarray_udiff_assoc_variation4.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation5.phpt b/ext/standard/tests/array/array_udiff_assoc_variation5.phpt new file mode 100644 index 0000000000..69380767bb --- /dev/null +++ b/ext/standard/tests/array/array_udiff_assoc_variation5.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test array_udiff_assoc() function : usage variation - incorrect comparison functions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_udiff_assoc() : usage variation - differing comparison functions*** + +-- comparison function with an incorrect return value -- +array(1) { + [0]=> + int(1) +} + +-- comparison function taking too many parameters -- + +Warning: Missing argument 3 for too_many_parameters() in %sarray_udiff_assoc_variation5.php on line %d +array(1) { + [0]=> + int(1) +} + +-- comparison function taking too few parameters -- +array(1) { + [0]=> + int(1) +} +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_error.phpt b/ext/standard/tests/array/array_udiff_error.phpt new file mode 100644 index 0000000000..dc9657756e --- /dev/null +++ b/ext/standard/tests/array/array_udiff_error.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test array_udiff() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_udiff() : error conditions *** + +-- Testing array_udiff() function with more than expected no. of arguments -- + +Warning: array_udiff() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_error.php on line %d +NULL + +-- Testing array_udiff() function with less than expected no. of arguments -- + +Warning: array_udiff(): at least 3 parameters are required, 2 given in %sarray_udiff_error.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_error.phpt b/ext/standard/tests/array/array_udiff_uassoc_error.phpt new file mode 100644 index 0000000000..e7d27e65db --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_error.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test array_udiff_uassoc() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_udiff_uassoc() : error conditions *** + +-- Testing array_udiff_uassoc() function with more than expected no. of arguments -- + +Warning: array_udiff_uassoc() expects parameter 5 to be a valid callback, no array or string given in %sarray_udiff_uassoc_error.php on line %d +NULL + +-- Testing array_udiff_uassoc() function with less than expected no. of arguments -- + +Warning: array_udiff_uassoc(): at least 4 parameters are required, 3 given in %sarray_udiff_uassoc_error.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 new file mode 100644 index 0000000000..a48d56d4da --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_udiff_uassoc() function : usage variation +--FILE-- + 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 arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_uassoc($value, $arr2, $data_comp_func, $key_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_uassoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_uassoc(): Argument #1 is not an array in %sarray_udiff_uassoc_variation1.php on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt new file mode 100644 index 0000000000..c205da73f2 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_udiff_uassoc() function : usage variation +--FILE-- + 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 arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_uassoc($arr1, $value, $data_comp_func, $key_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_uassoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_uassoc(): Argument #2 is not an array in %sarray_udiff_uassoc_variation2.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation3.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation3.phpt new file mode 100644 index 0000000000..76afda098b --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_variation3.phpt @@ -0,0 +1,254 @@ +--TEST-- +Test array_udiff_uassoc() function : usage variation +--FILE-- + 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, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // 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 data_comp_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_uassoc($arr1, $arr2, $value, $key_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_uassoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--empty array-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--int indexed array-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--associative array-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, first array member is not a valid class name or object in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--nested arrays-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation3.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation4.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation4.phpt new file mode 100644 index 0000000000..0beb15ff77 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_variation4.phpt @@ -0,0 +1,254 @@ +--TEST-- +Test array_udiff_uassoc() function : usage variation +--FILE-- + 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, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // 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 key_comp_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff_uassoc($arr1, $arr2, $data_comp_func, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff_uassoc() : usage variation *** + +--int 0-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--empty array-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--int indexed array-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--associative array-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, first array member is not a valid class name or object in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--nested arrays-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_udiff_uassoc_variation4.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt new file mode 100644 index 0000000000..87c7071856 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt @@ -0,0 +1,229 @@ +--TEST-- +Test array_udiff_uassoc() function : usage variation +--FILE-- + 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(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--int 1-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--float .5-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL + +--unset var-- + +Warning: array_udiff_uassoc(): Argument #3 is not an array in %sarray_udiff_uassoc_variation5.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt new file mode 100644 index 0000000000..ec752a31bb --- /dev/null +++ b/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test array_udiff_uassoc() function : usage variation +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_udiff_uassoc() : usage variation - differing comparison functions*** + +-- comparison function with an incorrect return value -- +array(1) { + [0]=> + int(1) +} + +-- comparison function taking too many parameters -- + +Warning: Missing argument 3 for too_many_parameters() in %sarray_udiff_uassoc_variation6.php on line %d +array(1) { + [0]=> + int(1) +} + +-- comparison function taking too few parameters -- +array(1) { + [0]=> + int(1) +} +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_variation1.phpt b/ext/standard/tests/array/array_udiff_variation1.phpt new file mode 100644 index 0000000000..d2c0e24099 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_variation1.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_udiff() function : usage variation +--FILE-- + 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 arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff($value, $arr2, $data_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff() : usage variation *** + +--int 0-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--int 1-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--float .5-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL + +--unset var-- + +Warning: array_udiff(): Argument #1 is not an array in %sarray_udiff_variation1.php on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_udiff_variation2.phpt b/ext/standard/tests/array/array_udiff_variation2.phpt new file mode 100644 index 0000000000..fd2c12d8ac --- /dev/null +++ b/ext/standard/tests/array/array_udiff_variation2.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_udiff() function : usage variation +--FILE-- + 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 arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff($arr1, $value, $data_comp_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff() : usage variation *** + +--int 0-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--int 1-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--float .5-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL + +--unset var-- + +Warning: array_udiff(): Argument #2 is not an array in %sarray_udiff_variation2.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_variation3.phpt b/ext/standard/tests/array/array_udiff_variation3.phpt new file mode 100644 index 0000000000..aeeee89bf1 --- /dev/null +++ b/ext/standard/tests/array/array_udiff_variation3.phpt @@ -0,0 +1,251 @@ +--TEST-- +Test array_udiff() function : usage variation +--FILE-- + 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, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // 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 data_comp_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_udiff($arr1, $arr2, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_udiff() : usage variation *** + +--int 0-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--int 1-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--float .5-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--empty array-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_variation3.php on line %d +NULL + +--int indexed array-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_variation3.php on line %d +NULL + +--associative array-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, first array member is not a valid class name or object in %sarray_udiff_variation3.php on line %d +NULL + +--nested arrays-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_udiff_variation3.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_variation3.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_udiff_variation3.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_variation3.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_udiff_variation3.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_udiff_variation3.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_udiff_variation3.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL + +--unset var-- + +Warning: array_udiff() expects parameter 3 to be a valid callback, no array or string given in %sarray_udiff_variation3.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_variation4.phpt b/ext/standard/tests/array/array_udiff_variation4.phpt new file mode 100644 index 0000000000..09dec4f9ec --- /dev/null +++ b/ext/standard/tests/array/array_udiff_variation4.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_udiff() function : usage variation +--FILE-- + 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(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--int 1-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--int 12345-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--int -12345-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--float 10.5-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--float -10.5-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--float .5-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--lowercase null-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--lowercase true-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--lowercase false-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--empty string DQ-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--empty string SQ-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--string DQ-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--string SQ-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--mixed case string-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--heredoc-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--undefined var-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL + +--unset var-- + +Warning: array_udiff(): Argument #3 is not an array in %sarray_udiff_variation4.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_variation5.phpt b/ext/standard/tests/array/array_udiff_variation5.phpt new file mode 100644 index 0000000000..49405d40be --- /dev/null +++ b/ext/standard/tests/array/array_udiff_variation5.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test array_udiff() function : usage variation +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_udiff() : usage variation *** + +-- comparison function with an incorrect return value -- +array(1) { + [0]=> + int(1) +} + +-- comparison function taking too many parameters -- + +Warning: Missing argument 3 for too_many_parameters() in %sarray_udiff_variation5.php on line %d +array(0) { +} + +-- comparison function taking too few parameters -- +array(0) { +} +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt b/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt new file mode 100644 index 0000000000..f0c7ecc802 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_uintersect_assoc() function : basic functionality - testing with multiple array arguments +--FILE-- + "one", "02" => "two", '3' => "three", "four", "0.5" => 5, 0.6 => 6, "0x7" => "seven"); +$arr2 = array("one" => "one", "02" => "two", '3' => "three"); +$arr3 = array("one" => "one", '3' => "three", "0.5" => 5); +$arr4 = array("one" => "one", '3' => "three", "0.5" => 5); + + +var_dump( array_uintersect_assoc($arr1, $arr2, $arr3, $arr4, $data_compare_function) ); + + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_assoc() : basic functionality - testing with multiple array arguments *** +array(2) { + ["one"]=> + string(3) "one" + [3]=> + string(5) "three" +} +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_error.phpt b/ext/standard/tests/array/array_uintersect_assoc_error.phpt new file mode 100644 index 0000000000..73fc61e397 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_error.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test array_uintersect_assoc() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_assoc() : error conditions *** + +-- Testing array_uintersect_assoc() function with more than expected no. of arguments -- + +Warning: array_uintersect_assoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_assoc_error.php on line %d +NULL + +-- Testing array_uintersect_assoc() function with less than expected no. of arguments -- + +Warning: array_uintersect_assoc(): at least 3 parameters are required, 2 given in %sarray_uintersect_assoc_error.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 new file mode 100644 index 0000000000..45d0a8da7c --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_uintersect_assoc() function : usage variation +--FILE-- + 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 arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_assoc($value, $arr2, $data_compare_function) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_assoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_assoc(): Argument #1 is not an array in %sarray_uintersect_assoc_variation1.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt new file mode 100644 index 0000000000..a421c252ad --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_uintersect_assoc() function : usage variation +--FILE-- + 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 arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_assoc($arr1, $value, $data_compare_function) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_assoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_assoc(): Argument #2 is not an array in %sarray_uintersect_assoc_variation2.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation3.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation3.phpt new file mode 100644 index 0000000000..a76fca0f5c --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_variation3.phpt @@ -0,0 +1,251 @@ +--TEST-- +Test array_uintersect_assoc() function : usage variation +--FILE-- + 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, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // 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 data_compare_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_assoc($arr1, $arr2, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_assoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--empty array-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--int indexed array-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--associative array-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, first array member is not a valid class name or object in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--nested arrays-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_assoc_variation3.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt new file mode 100644 index 0000000000..abff23ad50 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_uintersect_assoc() function : usage variation +--FILE-- + 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(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_assoc(): Argument #3 is not an array in %sarray_uintersect_assoc_variation4.php on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt new file mode 100644 index 0000000000..e2d7bd03a6 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test array_uintersect_assoc() function : usage variation - differing comparison functions +--FILE-- + + +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_assoc() : usage variation - differing comparison functions*** + +-- comparison function with an incorrect return value -- +array(0) { +} + +-- comparison function taking too many parameters -- + +Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_assoc_variation5.php on line %d +array(0) { +} + +-- comparison function taking too few parameters -- +array(0) { +} + +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_error.phpt b/ext/standard/tests/array/array_uintersect_error.phpt new file mode 100644 index 0000000000..1b25db4345 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_error.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test array_uintersect() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_uintersect() : error conditions *** + +-- Testing array_uintersect() function with more than expected no. of arguments -- + +Warning: array_uintersect() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_error.php on line %d +NULL + +-- Testing array_uintersect() function with less than expected no. of arguments -- + +Warning: array_uintersect(): at least 3 parameters are required, 2 given in %sarray_uintersect_error.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_error.phpt b/ext/standard/tests/array/array_uintersect_uassoc_error.phpt new file mode 100644 index 0000000000..c7391eeda9 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_error.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test array_uintersect_uassoc() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_uassoc() : error conditions *** + +-- Testing array_uintersect_uassoc() function with more than expected no. of arguments -- + +Warning: array_uintersect_uassoc() expects parameter 5 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_error.php on line %d +NULL + +-- Testing array_uintersect_uassoc() function with less than expected no. of arguments -- + +Warning: array_uintersect_uassoc(): at least 4 parameters are required, 3 given in %sarray_uintersect_uassoc_error.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 new file mode 100644 index 0000000000..764c584b2e --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_uintersect_uassoc() function : usage variation +--FILE-- + 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 arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_uassoc($value, $arr2, $data_compare_func, $key_compare_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_uassoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_uassoc(): Argument #1 is not an array in %sarray_uintersect_uassoc_variation1.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt new file mode 100644 index 0000000000..2efa93d0cb --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_uintersect_uassoc() function : usage variation +--FILE-- + 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 arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_uassoc($arr1, $value, $data_compare_func, $key_compare_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_uassoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_uassoc(): Argument #2 is not an array in %sarray_uintersect_uassoc_variation2.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation3.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation3.phpt new file mode 100644 index 0000000000..860a1661a6 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation3.phpt @@ -0,0 +1,254 @@ +--TEST-- +Test array_uintersect_uassoc() function : usage variation +--FILE-- + 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, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // 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 data_compare_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_uassoc($arr1, $arr2, $value, $key_compare_func) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_uassoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--empty array-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--int indexed array-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--associative array-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, first array member is not a valid class name or object in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--nested arrays-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_uassoc() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation3.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation4.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation4.phpt new file mode 100644 index 0000000000..a3963184c3 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation4.phpt @@ -0,0 +1,254 @@ +--TEST-- +Test array_uintersect_uassoc() function : usage variation +--FILE-- + 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, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // 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 key_compare_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect_uassoc($arr1, $arr2, $data_compare_func, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_uassoc() : usage variation *** + +--int 0-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--empty array-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--int indexed array-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--associative array-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, first array member is not a valid class name or object in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--nested arrays-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_uassoc() expects parameter 4 to be a valid callback, no array or string given in %sarray_uintersect_uassoc_variation4.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt new file mode 100644 index 0000000000..061ac60ed8 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt @@ -0,0 +1,229 @@ +--TEST-- +Test array_uintersect_uassoc() function : usage variation +--FILE-- + 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(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect_uassoc(): Argument #3 is not an array in %sarray_uintersect_uassoc_variation5.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt new file mode 100644 index 0000000000..6ed86f8417 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test array_uintersect_uassoc() function : usage variation - incorrect callbacks +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing array_uintersect_uassoc() : usage variation - incorrect callbacks *** + +-- comparison function with an incorrect return value -- +array(0) { +} + +-- comparison function taking too many parameters -- + +Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_uassoc_variation6.php on line %d + +Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_uassoc_variation6.php on line %d + +Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_uassoc_variation6.php on line %d +array(0) { +} + +-- comparison function taking too few parameters -- +array(0) { +} +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation1.phpt b/ext/standard/tests/array/array_uintersect_variation1.phpt new file mode 100644 index 0000000000..0663a958f1 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_variation1.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_uintersect() function : usage variation +--FILE-- + 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 arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect($value, $arr2, $data_compare_function) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect() : usage variation *** + +--int 0-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect(): Argument #1 is not an array in %sarray_uintersect_variation1.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation2.phpt b/ext/standard/tests/array/array_uintersect_variation2.phpt new file mode 100644 index 0000000000..79f4cd09c8 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_variation2.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test array_uintersect() function : usage variation +--FILE-- + 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 arr2 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect($arr1, $value, $data_compare_function) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect() : usage variation *** + +--int 0-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect(): Argument #2 is not an array in %sarray_uintersect_variation2.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation3.phpt b/ext/standard/tests/array/array_uintersect_variation3.phpt new file mode 100644 index 0000000000..707ba113c8 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_variation3.phpt @@ -0,0 +1,251 @@ +--TEST-- +Test array_uintersect() function : usage variation +--FILE-- + 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, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // 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 data_compare_func + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_uintersect($arr1, $arr2, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing array_uintersect() : usage variation *** + +--int 0-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--empty array-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_variation3.php on line %d +NULL + +--int indexed array-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_variation3.php on line %d +NULL + +--associative array-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, first array member is not a valid class name or object in %sarray_uintersect_variation3.php on line %d +NULL + +--nested arrays-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, array must have exactly two members in %sarray_uintersect_variation3.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_variation3.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, function '' not found or invalid function name in %sarray_uintersect_variation3.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_variation3.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, function 'string' not found or invalid function name in %sarray_uintersect_variation3.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, function 'sTrInG' not found or invalid function name in %sarray_uintersect_variation3.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, function 'hello world' not found or invalid function name in %sarray_uintersect_variation3.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect() expects parameter 3 to be a valid callback, no array or string given in %sarray_uintersect_variation3.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation4.phpt b/ext/standard/tests/array/array_uintersect_variation4.phpt new file mode 100644 index 0000000000..45207b3c12 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_variation4.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test array_uintersect() function : usage variation +--FILE-- + 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(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--int 1-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--int 12345-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--int -12345-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--float 10.5-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--float -10.5-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--float .5-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--uppercase NULL-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--lowercase null-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--lowercase true-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--lowercase false-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--uppercase TRUE-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--uppercase FALSE-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--empty string DQ-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--empty string SQ-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--string DQ-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--string SQ-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--mixed case string-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--heredoc-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--instance of classWithToString-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--undefined var-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL + +--unset var-- + +Warning: array_uintersect(): Argument #3 is not an array in %sarray_uintersect_variation4.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation5.phpt b/ext/standard/tests/array/array_uintersect_variation5.phpt new file mode 100644 index 0000000000..75cf08e270 --- /dev/null +++ b/ext/standard/tests/array/array_uintersect_variation5.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test array_uintersect() function : usage variation - differing comparison functions +--FILE-- + + +===DONE=== +--EXPECTF-- +*** Testing array_uintersect() : usage variation - differing comparison functions*** + +-- comparison function with an incorrect return value -- +array(0) { +} + +-- comparison function taking too many parameters -- + +Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d + +Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d + +Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d +array(0) { +} + +-- comparison function taking too few parameters -- +array(0) { +} + +===DONE=== diff --git a/ext/standard/tests/array/array_unshift_variation1.phpt b/ext/standard/tests/array/array_unshift_variation1.phpt index f75bf6055f..4d0c8c2069 100644 --- a/ext/standard/tests/array/array_unshift_variation1.phpt +++ b/ext/standard/tests/array/array_unshift_variation1.phpt @@ -330,9 +330,9 @@ NULL -- Iteration 24 -- Warning: array_unshift() expects parameter 1 to be array, resource given in %s on line %d NULL -resource(5) of type (stream) +resource(%d) of type (stream) Warning: array_unshift() expects parameter 1 to be array, resource given in %s on line %d NULL -resource(5) of type (stream) +resource(%d) of type (stream) Done diff --git a/ext/standard/tests/array/array_values_error.phpt b/ext/standard/tests/array/array_values_error.phpt new file mode 100644 index 0000000000..07d682c9e1 --- /dev/null +++ b/ext/standard/tests/array/array_values_error.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test array_values() function : error conditions - Pass incorrect number of functions +--FILE-- + + +--EXPECTF-- +*** Testing array_values() : error conditions *** + +-- Testing array_values() function with Zero arguments -- + +Warning: array_values() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing array_values() function with more than expected no. of arguments -- + +Warning: array_values() expects exactly 1 parameter, 2 given in %s on line %d +NULL +Done + diff --git a/ext/standard/tests/array/array_values_variation7.phpt b/ext/standard/tests/array/array_values_variation7.phpt new file mode 100644 index 0000000000..b713064569 --- /dev/null +++ b/ext/standard/tests/array/array_values_variation7.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test array_values() function : usage variations - Internal order check +--FILE-- + 'three', 2 => 'two', 1 => 'one', 0 => 'zero'); + +echo "\n-- \$input argument: --\n"; +var_dump($input); + +echo "\n-- Result of array_values() --\n"; +var_dump(array_values($input)); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_values() : usage variations *** + +-- $input argument: -- +array(4) { + [3]=> + string(5) "three" + [2]=> + string(3) "two" + [1]=> + string(3) "one" + [0]=> + string(4) "zero" +} + +-- Result of array_values() -- +array(4) { + [0]=> + string(5) "three" + [1]=> + string(3) "two" + [2]=> + string(3) "one" + [3]=> + string(4) "zero" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_basic.phpt b/ext/standard/tests/array/arsort_basic.phpt new file mode 100644 index 0000000000..481a590701 --- /dev/null +++ b/ext/standard/tests/array/arsort_basic.phpt @@ -0,0 +1,133 @@ +--TEST-- +Test arsort() function : basic functionality +--FILE-- + "lemon", "o" => "orange", "b" => "banana" ); +// an array containing unsorted numeric values with indices +$unsorted_numerics = array( 1 => 100, 2 => 33, 3 => 555, 4 => 22 ); + +echo "\n-- Testing arsort() by supplying string array, 'flag' value is default --\n"; +$temp_array = $unsorted_strings; +var_dump( arsort($temp_array) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying numeric array, 'flag' value is default --\n"; +$temp_array = $unsorted_numerics; +var_dump( arsort($temp_array) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying string array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $unsorted_strings; +var_dump( arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying numeric array, 'flag' = SORT_REGULAR --\n"; +$temp_array = $unsorted_numerics; +var_dump( arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying string array, 'flag' = SORT_STRING --\n"; +$temp_array = $unsorted_strings; +var_dump( arsort($temp_array, SORT_STRING) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "\n-- Testing arsort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n"; +$temp_array = $unsorted_numerics; +var_dump( arsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true) +var_dump( $temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing arsort() : basic functionality *** + +-- Testing arsort() by supplying string array, 'flag' value is default -- +bool(true) +array(3) { + ["o"]=> + string(6) "orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" +} + +-- Testing arsort() by supplying numeric array, 'flag' value is default -- +bool(true) +array(4) { + [3]=> + int(555) + [1]=> + int(100) + [2]=> + int(33) + [4]=> + int(22) +} + +-- Testing arsort() by supplying string array, 'flag' = SORT_REGULAR -- +bool(true) +array(3) { + ["o"]=> + string(6) "orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" +} + +-- Testing arsort() by supplying numeric array, 'flag' = SORT_REGULAR -- +bool(true) +array(4) { + [3]=> + int(555) + [1]=> + int(100) + [2]=> + int(33) + [4]=> + int(22) +} + +-- Testing arsort() by supplying string array, 'flag' = SORT_STRING -- +bool(true) +array(3) { + ["o"]=> + string(6) "orange" + ["l"]=> + string(5) "lemon" + ["b"]=> + string(6) "banana" +} + +-- Testing arsort() by supplying numeric array, 'flag' = SORT_NUMERIC -- +bool(true) +array(4) { + [3]=> + int(555) + [1]=> + int(100) + [2]=> + int(33) + [4]=> + int(22) +} +Done \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_object1.phpt b/ext/standard/tests/array/arsort_object1.phpt new file mode 100644 index 0000000000..8fd80f91b8 --- /dev/null +++ b/ext/standard/tests/array/arsort_object1.phpt @@ -0,0 +1,90 @@ +--TEST-- +Test arsort() function : object functionality - sort objects +--FILE-- +class_value = $value; + } + +} + +// class declaration for string objects +class for_string_arsort +{ + public $class_value; + // initializing object member value + function __construct($value){ + $this->class_value = $value; + } + + // return string value + function __tostring() { + return (string)$this->value; + } + +} + +// array of integer objects +$unsorted_int_obj = array ( + 1 => new for_integer_arsort(11), 2 => new for_integer_asort(66), + 3 => new for_integer_arsort(23), 4 => new for_integer_asort(-5), + 5 => new for_integer_arsort(0.001), 6 => new for_integer_asort(0) +); + +// array of string objects +$unsorted_str_obj = array ( + "a" => new for_string_arsort("axx"), "b" => new for_string_asort("t"), + "c" => new for_string_arsort("w"), "d" => new for_string_asort("py"), + "e" => new for_string_arsort("apple"), "f" => new for_string_asort("Orange"), + "g" => new for_string_arsort("Lemon"), "h" => new for_string_asort("aPPle") +); + + +echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is defualt --\n"; + +// testing arsort() function by supplying integer object array, flag value is defualt +$temp_array = $unsorted_int_obj; +var_dump(arsort($temp_array) ); +var_dump($temp_array); + +// testing arsort() function by supplying string object array, flag value is defualt +$temp_array = $unsorted_str_obj; +var_dump(arsort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n"; +// testing arsort() function by supplying integer object array, flag value = SORT_REGULAR +$temp_array = $unsorted_int_obj; +var_dump(arsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +// testing arsort() function by supplying string object array, flag value = SORT_REGULAR +$temp_array = $unsorted_str_obj; +var_dump(arsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing arsort() : object functionality *** + +Fatal error: Class 'for_integer_asort' not found in %sarsort_object1.php on line %d \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_object2.phpt b/ext/standard/tests/array/arsort_object2.phpt new file mode 100644 index 0000000000..24da657878 --- /dev/null +++ b/ext/standard/tests/array/arsort_object2.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test arsort() function : object functionality - sorting objects with diff. accessibility of member vars +--FILE-- +public_class_value = $value1; + $this->private_class_value = $value2; + $this->protected_class_value = $value3; + } + +} + +// class declaration for string objects +class for_string_arsort +{ + public $public_class_value; + private $private_class_value; + protected $protected_class_value; + // initializing object member value + function __construct($value1, $value2,$value3){ + $this->public_class_value = $value1; + $this->private_class_value = $value2; + $this->protected_class_value = $value3; + } + + // return string value + function __tostring() { + return (string)$this->value; + } +} + +// array of integer objects +$unsorted_int_obj = array ( + 1 => new for_integer_arsort(11, 33,2), 2 => new for_integer_asort(44, 66,3), + 3 => new for_integer_arsort(23, 32,6), 4 => new for_integer_asort(-88, -5,-4), +); + +// array of string objects +$unsorted_str_obj = array ( + "a" => new for_string_arsort("axx","AXX","d"), "b" => new for_string_asort("T", "t","q"), + "c" => new for_string_arsort("w", "W","c"), "d" => new for_string_asort("PY", "py","s"), +); + + +echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is default --\n"; + +// testing arsort() function by supplying integer object array, flag value is default +$temp_array = $unsorted_int_obj; +var_dump(arsort($temp_array) ); +var_dump($temp_array); + +// testing arsort() function by supplying string object array, flag value is default +$temp_array = $unsorted_str_obj; +var_dump(arsort($temp_array) ); +var_dump($temp_array); + +echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n"; +// testing arsort() function by supplying integer object array, flag value = SORT_REGULAR +$temp_array = $unsorted_int_obj; +var_dump(arsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +// testing arsort() function by supplying string object array, flag value = SORT_REGULAR +$temp_array = $unsorted_str_obj; +var_dump(arsort($temp_array, SORT_REGULAR) ); +var_dump($temp_array); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing arsort() : object functionality *** + +Fatal error: Class 'for_integer_asort' not found in %sarsort_object2.php on line %d \ No newline at end of file diff --git a/ext/standard/tests/array/arsort_variation3.phpt b/ext/standard/tests/array/arsort_variation3.phpt index 609155ca73..eab3b45f62 100644 --- a/ext/standard/tests/array/arsort_variation3.phpt +++ b/ext/standard/tests/array/arsort_variation3.phpt @@ -1,5 +1,9 @@ --TEST-- Test arsort() function : usage variations - sort integer/float values +--SKIPIF-- + --FILE-- ---EXPECTF-- +--EXPECT-- *** Testing arsort() : usage variations *** -- Testing arsort() by supplying various integer/float arrays -- @@ -273,7 +277,7 @@ array(11) { bool(true) array(7) { [2]=> - %s(2147483648) + float(2147483648) [1]=> int(2147483647) [6]=> @@ -283,15 +287,15 @@ array(7) { [3]=> int(-2147483647) [4]=> - %s(-2147483648) + float(-2147483648) [7]=> - %s(-2147483649) + float(-2147483649) } - Sort_flag = SORT_REGULAR - bool(true) array(7) { [2]=> - %s(2147483648) + float(2147483648) [1]=> int(2147483647) [6]=> @@ -301,15 +305,15 @@ array(7) { [3]=> int(-2147483647) [4]=> - %s(-2147483648) + float(-2147483648) [7]=> - %s(-2147483649) + float(-2147483649) } - Sort_flag = SORT_NUMERIC - bool(true) array(7) { [2]=> - %s(2147483648) + float(2147483648) [1]=> int(2147483647) [6]=> @@ -319,8 +323,8 @@ array(7) { [3]=> int(-2147483647) [4]=> - %s(-2147483648) + float(-2147483648) [7]=> - %s(-2147483649) + float(-2147483649) } Done \ No newline at end of file diff --git a/ext/standard/tests/array/bug44181.phpt b/ext/standard/tests/array/bug44181.phpt new file mode 100644 index 0000000000..3da73cb1a6 --- /dev/null +++ b/ext/standard/tests/array/bug44181.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #44181 (extract EXTR_OVERWRITE|EXTR_REFS can fail to create references) +--FILE-- + 'original.foo'); + +$foo = 'test'; +$ref = &$a; + +extract($a, EXTR_OVERWRITE|EXTR_REFS); +$foo = 'changed.foo'; + +var_dump($a['foo']); +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "changed.foo" +Done + diff --git a/ext/standard/tests/array/bug44182.phpt b/ext/standard/tests/array/bug44182.phpt new file mode 100644 index 0000000000..47f3caafb8 --- /dev/null +++ b/ext/standard/tests/array/bug44182.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #44182 (extract EXTR_REFS can fail to split copy-on-write references) +--FILE-- + 'original.foo'); + +$nonref = $a['foo']; +$ref = &$a; + +extract($a, EXTR_REFS); +$a['foo'] = 'changed.foo'; + +var_dump($nonref); +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "original.foo" +Done + diff --git a/ext/standard/tests/array/compact_variation2.phpt b/ext/standard/tests/array/compact_variation2.phpt new file mode 100644 index 0000000000..79db8ab047 --- /dev/null +++ b/ext/standard/tests/array/compact_variation2.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test compact() function: ensure compact() doesn't pick up variables declared outside of current scope. +--FILE-- + +==Done== +--EXPECTF-- +*** Testing compact() : usage variations - variables outside of current scope *** +array(2) { + ["b"]=> + string(3) "f.b" + ["c"]=> + string(3) "f.c" +} +array(2) { + ["b"]=> + string(3) "f.b" + ["c"]=> + string(3) "f.c" +} +==Done== \ No newline at end of file diff --git a/ext/standard/tests/array/compare_function.inc b/ext/standard/tests/array/compare_function.inc new file mode 100644 index 0000000000..e5176802ab --- /dev/null +++ b/ext/standard/tests/array/compare_function.inc @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/ext/standard/tests/array/each_error.phpt b/ext/standard/tests/array/each_error.phpt index 0834435610..0806bee674 100644 --- a/ext/standard/tests/array/each_error.phpt +++ b/ext/standard/tests/array/each_error.phpt @@ -39,4 +39,5 @@ NULL Warning: each() expects exactly 1 parameter, 2 given in %s on line %d NULL -Done \ No newline at end of file +Done + diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt index 6ac57a736e..16b6096396 100644 --- a/ext/standard/tests/array/each_variation4.phpt +++ b/ext/standard/tests/array/each_variation4.phpt @@ -1,7 +1,5 @@ --TEST-- Test each() function : usage variations - Referenced variables ---INI-- -allow_call_time_pass_reference=on --FILE-- string(3) "two" } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation1.phpt b/ext/standard/tests/array/natcasesort_variation1.phpt index 04e3c05da6..59eadedf66 100644 --- a/ext/standard/tests/array/natcasesort_variation1.phpt +++ b/ext/standard/tests/array/natcasesort_variation1.phpt @@ -220,3 +220,4 @@ NULL Warning: natcasesort() expects parameter 1 to be array, resource given in %s on line %d NULL Done + diff --git a/ext/standard/tests/array/natcasesort_variation3.phpt b/ext/standard/tests/array/natcasesort_variation3.phpt index f151508433..77f83e1d09 100644 --- a/ext/standard/tests/array/natcasesort_variation3.phpt +++ b/ext/standard/tests/array/natcasesort_variation3.phpt @@ -132,4 +132,4 @@ array(7) { [1]=> float(2147483648) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natsort_basic.phpt b/ext/standard/tests/array/natsort_basic.phpt new file mode 100644 index 0000000000..e38359fe68 --- /dev/null +++ b/ext/standard/tests/array/natsort_basic.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test natsort(): basic functionality +--FILE-- + +--EXPECT-- +Standard sorting +Array +( + [0] => img1.png + [1] => img10.png + [2] => img12.png + [3] => img2.png +) + +Natural order sorting +Array +( + [3] => img1.png + [2] => img2.png + [1] => img10.png + [0] => img12.png +) + diff --git a/ext/standard/tests/array/rsort_variation3.phpt b/ext/standard/tests/array/rsort_variation3.phpt index 798e148c7b..f8c002a6f7 100644 --- a/ext/standard/tests/array/rsort_variation3.phpt +++ b/ext/standard/tests/array/rsort_variation3.phpt @@ -322,4 +322,4 @@ array(7) { [6]=> float(-2147483649) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation4.phpt b/ext/standard/tests/array/rsort_variation4.phpt index 4cab1a9334..abbed35bad 100644 --- a/ext/standard/tests/array/rsort_variation4.phpt +++ b/ext/standard/tests/array/rsort_variation4.phpt @@ -1,7 +1,5 @@ --TEST-- Test rsort() function : usage variations - referenced variables ---INI-- -allow_call_time_pass_reference=on --FILE-- &int(33) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/uksort_basic.phpt b/ext/standard/tests/array/uksort_basic.phpt new file mode 100644 index 0000000000..f83c0329da --- /dev/null +++ b/ext/standard/tests/array/uksort_basic.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test uksort(): basic functionality +--FILE-- + $value) { + echo "$key: $value\n"; +} +?> +--EXPECT-- +4: 1 +1: 2 +0: 3 +2: 5 +3: 6 \ No newline at end of file diff --git a/ext/standard/tests/array/uksort_error.phpt b/ext/standard/tests/array/uksort_error.phpt new file mode 100644 index 0000000000..241ed2f828 --- /dev/null +++ b/ext/standard/tests/array/uksort_error.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test uksort() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing uksort() : error conditions *** + +-- Testing uksort() function with more than expected no. of arguments -- + +Warning: uksort() expects exactly 2 parameters, 3 given in %suksort_error.php on line %d +NULL + +-- Testing uksort() function with less than expected no. of arguments -- + +Warning: uksort() expects exactly 2 parameters, 1 given in %suksort_error.php on line %d +NULL + +-- Testing uksort() function with zero arguments -- + +Warning: uksort() expects exactly 2 parameters, 0 given in %suksort_error.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/uksort_variation1.phpt b/ext/standard/tests/array/uksort_variation1.phpt new file mode 100644 index 0000000000..3189f7fbf2 --- /dev/null +++ b/ext/standard/tests/array/uksort_variation1.phpt @@ -0,0 +1,224 @@ +--TEST-- +Test uksort() function : usage variation +--FILE-- + 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 array_arg + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( uksort($value, $cmp_function) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing uksort() : usage variation *** + +--int 0-- + +Warning: uksort() expects parameter 1 to be array, integer given in %suksort_variation1.php on line %d +NULL + +--int 1-- + +Warning: uksort() expects parameter 1 to be array, integer given in %suksort_variation1.php on line %d +NULL + +--int 12345-- + +Warning: uksort() expects parameter 1 to be array, integer given in %suksort_variation1.php on line %d +NULL + +--int -12345-- + +Warning: uksort() expects parameter 1 to be array, integer given in %suksort_variation1.php on line %d +NULL + +--float 10.5-- + +Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d +NULL + +--float -10.5-- + +Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d +NULL + +--float .5-- + +Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d +NULL + +--uppercase NULL-- + +Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d +NULL + +--lowercase null-- + +Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d +NULL + +--lowercase true-- + +Warning: uksort() expects parameter 1 to be array, boolean given in %suksort_variation1.php on line %d +NULL + +--lowercase false-- + +Warning: uksort() expects parameter 1 to be array, boolean given in %suksort_variation1.php on line %d +NULL + +--uppercase TRUE-- + +Warning: uksort() expects parameter 1 to be array, boolean given in %suksort_variation1.php on line %d +NULL + +--uppercase FALSE-- + +Warning: uksort() expects parameter 1 to be array, boolean given in %suksort_variation1.php on line %d +NULL + +--empty string DQ-- + +Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d +NULL + +--string DQ-- + +Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d +NULL + +--string SQ-- + +Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d +NULL + +--heredoc-- + +Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d +NULL + +--instance of classWithToString-- + +Warning: uksort() expects parameter 1 to be array, object given in %suksort_variation1.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: uksort() expects parameter 1 to be array, object given in %suksort_variation1.php on line %d +NULL + +--undefined var-- + +Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d +NULL + +--unset var-- + +Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/uksort_variation2.phpt b/ext/standard/tests/array/uksort_variation2.phpt new file mode 100644 index 0000000000..2f5b8b5d89 --- /dev/null +++ b/ext/standard/tests/array/uksort_variation2.phpt @@ -0,0 +1,224 @@ +--TEST-- +Test uksort() function : usage variation +--FILE-- + 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, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // 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' => '', + + // 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 cmp_function + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( uksort($array_arg, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing uksort() : usage variation *** + +--int 0-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--int 1-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--int 12345-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--int -12345-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--float 10.5-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--float -10.5-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--float 12.3456789000e10-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--float -12.3456789000e10-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--float .5-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--empty array-- + +Warning: uksort() expects parameter 2 to be a valid callback, array must have exactly two members in %suksort_variation2.php on line %d +NULL + +--int indexed array-- + +Warning: uksort() expects parameter 2 to be a valid callback, array must have exactly two members in %suksort_variation2.php on line %d +NULL + +--associative array-- + +Warning: uksort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %suksort_variation2.php on line %d +NULL + +--nested arrays-- + +Warning: uksort() expects parameter 2 to be a valid callback, array must have exactly two members in %suksort_variation2.php on line %d +NULL + +--uppercase NULL-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--lowercase null-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--lowercase true-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--lowercase false-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--uppercase TRUE-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--uppercase FALSE-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--empty string DQ-- + +Warning: uksort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %suksort_variation2.php on line %d +NULL + +--empty string SQ-- + +Warning: uksort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %suksort_variation2.php on line %d +NULL + +--instance of classWithToString-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--instance of classWithoutToString-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--undefined var-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL + +--unset var-- + +Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/usort_basic.phpt b/ext/standard/tests/array/usort_basic.phpt new file mode 100644 index 0000000000..eaf30188de --- /dev/null +++ b/ext/standard/tests/array/usort_basic.phpt @@ -0,0 +1,119 @@ +--TEST-- +Test usort() function : basic functionality +--FILE-- + $value2) { + return 1; + } + else + return -1; +} + +// Int array with default keys +$int_values = array(1, 8, 9, 3, 2, 6, 7); + +echo "\n-- Numeric array with default keys --\n"; +var_dump( usort($int_values, 'cmp') ); +var_dump($int_values); + +// String array with default keys +$string_values = array("This", "is", 'a', "test"); + +echo "\n-- String array with default keys --\n"; +var_dump( usort($string_values, 'cmp') ); +var_dump($string_values); + +// Associative array with numeric keys +$numeric_key_arg = array(1=> 1, 2 => 2, 3 => 7, 5 => 4, 4 => 9); + +echo "\n-- Associative array with numeric keys --\n"; +var_dump( usort($numeric_key_arg, 'cmp') ); +var_dump($numeric_key_arg); + +// Associative array with string keys +$string_key_arg = array('one' => 4, 'two' => 2, 'three' => 1, 'four' => 10); + +echo "\n-- Associative array with string keys --\n"; +var_dump( usort($string_key_arg, 'cmp') ); +var_dump($string_key_arg); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : basic functionality *** + +-- Numeric array with default keys -- +bool(true) +array(7) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(6) + [4]=> + int(7) + [5]=> + int(8) + [6]=> + int(9) +} + +-- String array with default keys -- +bool(true) +array(4) { + [0]=> + string(4) "This" + [1]=> + string(1) "a" + [2]=> + string(2) "is" + [3]=> + string(4) "test" +} + +-- Associative array with numeric keys -- +bool(true) +array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(4) + [3]=> + int(7) + [4]=> + int(9) +} + +-- Associative array with string keys -- +bool(true) +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(4) + [3]=> + int(10) +} +===DONE=== diff --git a/ext/standard/tests/array/usort_error1.phpt b/ext/standard/tests/array/usort_error1.phpt new file mode 100644 index 0000000000..70c555e346 --- /dev/null +++ b/ext/standard/tests/array/usort_error1.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test usort() function : error conditions - Pass incorrect number of arguments +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing usort() : error conditions *** + +-- Testing usort() function with more than expected no. of arguments -- + +Warning: usort() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing usort() function with less than expected no. of arguments -- + +Warning: usort() expects exactly 2 parameters, 1 given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_error2.phpt b/ext/standard/tests/array/usort_error2.phpt new file mode 100644 index 0000000000..308199fc1f --- /dev/null +++ b/ext/standard/tests/array/usort_error2.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test usort() function : error conditions - Pass unknown 'cmp_function' +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +// Initialize 'array_arg' +$array_arg = array(0 => 1, 1 => 10, 2 => 'string', 3 => 3, 4 => 2, 5 => 100, 6 => 25); +$extra_arg = 10; + +// With non existent comparison function +echo "\n-- Testing usort() function with non-existent compare function --\n"; +var_dump( usort($array_arg, 'non_existent') ); + +// With non existent comparison function and extra arguemnt +echo "\n-- Testing usort() function with non-existent compare function and extra argument --\n"; +var_dump( usort($array_arg, 'non_existent', $extra_arg) ); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : error conditions *** + +-- Testing usort() function with non-existent compare function -- + +Warning: usort() expects parameter 2 to be a valid callback, function 'non_existent' not found or invalid function name in %s on line %d +NULL + +-- Testing usort() function with non-existent compare function and extra argument -- + +Warning: usort() expects exactly 2 parameters, 3 given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_object1.phpt b/ext/standard/tests/array/usort_object1.phpt new file mode 100644 index 0000000000..0e87443d1c --- /dev/null +++ b/ext/standard/tests/array/usort_object1.phpt @@ -0,0 +1,141 @@ +--TEST-- +Test usort() function : object functionality - different number of properties +--FILE-- + $value2) { + return 1; + } + else + return -1; +} + +// comparison function for SimpleClass2 objects which has more than one member +function multiple_cmp($value1, $value2) +{ + if($value1->getValue() == $value2->getValue()) + return 0; + else if($value1->getValue() > $value2->getValue()) + return 1; + else + return -1; +} + +// Simple class with single property +class SimpleClass1 +{ + private $int_value; + + public function __construct($value) { + $this->int_value = $value; + } +} + +// Simple class with more than one property +class SimpleClass2 +{ + private $int_value; + protected $float_value; + public $string_value; + public function __construct($int, $float, $str) { + $this->int_value = $int; + $this->float_value = $float; + $this->string_value = $str; + } + public function getValue() { + return $this->int_value; + } +} + +// array of SimpleClass objects with only one property +$array_arg = array( +0 => new SimpleClass1(10), +1 => new SimpleClass1(1), +2 => new SimpleClass1(100), +3 => new SimpleClass1(50) +); +var_dump( usort($array_arg, 'simple_cmp') ); +var_dump($array_arg); + +// array of SimpleClass objects having more than one properties +$array_arg = array( +0 => new SimpleClass2(2, 3.4, "mango"), +1 => new SimpleClass2(10, 1.2, "apple"), +2 => new SimpleClass2(5, 2.5, "orange"), +); +var_dump( usort($array_arg, 'multiple_cmp') ); +var_dump($array_arg); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : object functionality *** +bool(true) +array(4) { + [0]=> + object(SimpleClass1)#%d (1) { + ["int_value":"SimpleClass1":private]=> + int(1) + } + [1]=> + object(SimpleClass1)#%d (1) { + ["int_value":"SimpleClass1":private]=> + int(10) + } + [2]=> + object(SimpleClass1)#%d (1) { + ["int_value":"SimpleClass1":private]=> + int(50) + } + [3]=> + object(SimpleClass1)#%d (1) { + ["int_value":"SimpleClass1":private]=> + int(100) + } +} +bool(true) +array(3) { + [0]=> + object(SimpleClass2)#%d (3) { + ["int_value":"SimpleClass2":private]=> + int(2) + ["float_value":protected]=> + float(3.4) + ["string_value"]=> + string(5) "mango" + } + [1]=> + object(SimpleClass2)#%d (3) { + ["int_value":"SimpleClass2":private]=> + int(5) + ["float_value":protected]=> + float(2.5) + ["string_value"]=> + string(6) "orange" + } + [2]=> + object(SimpleClass2)#%d (3) { + ["int_value":"SimpleClass2":private]=> + int(10) + ["float_value":protected]=> + float(1.2) + ["string_value"]=> + string(5) "apple" + } +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_object2.phpt b/ext/standard/tests/array/usort_object2.phpt new file mode 100644 index 0000000000..00d302f35b --- /dev/null +++ b/ext/standard/tests/array/usort_object2.phpt @@ -0,0 +1,165 @@ +--TEST-- +Test usort() function : object functionality - Different types of classes +--FILE-- + $value2) { + return 1; + } + else + return -1; +} + +// Class without any member +class EmptyClass +{ +} + +// Class with static member +class StaticClass +{ + public static $static_value; + public function __construct($value) { + StaticClass::$static_value = $value; + } +} + +// Abstract class +abstract class AbstractClass +{ + public $pub_value; + public abstract function abstractMethod(); +} + +// Child class extending abstract class +class ChildClass extends AbstractClass +{ + public $child_value = 100; + public function abstractMethod() { + $pub_value = 5; + } + public function __construct($value) { + $this->child_value = $value; + } +} + +// Testing uasort with StaticClass objects as elements of 'array_arg' +echo "-- Testing usort() with StaticClass objects --\n"; +$array_arg = array( + 0 => new StaticClass(20), + 1 => new StaticClass(50), + 2 => new StaticClass(15), + 3 => new StaticClass(70), +); +var_dump( usort($array_arg, 'cmp_function') ); +var_dump($array_arg); + +// Testing uasort with EmptyClass objects as elements of 'array_arg' +echo "-- Testing usort() with EmptyClass objects --\n"; +$array_arg = array( + 0 => new EmptyClass(), + 1 => new EmptyClass(), + 2 => new EmptyClass(), + 3 => new EmptyClass(), +); +var_dump( usort($array_arg, 'cmp_function') ); +var_dump($array_arg); + +// Testing uasort with ChildClass objects as elements of 'array_arg' +echo "-- Testing usort() with ChildClass objects --\n"; +$array_arg = array( + 0 => new ChildClass(20), + 1 => new ChildClass(500), + 2 => new ChildClass(15), + 3 => new ChildClass(700), +); +var_dump( usort($array_arg, 'cmp_function') ); +var_dump($array_arg); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : object functionality *** +-- Testing usort() with StaticClass objects -- +bool(true) +array(4) { + [0]=> + object(StaticClass)#%d (0) { + } + [1]=> + object(StaticClass)#%d (0) { + } + [2]=> + object(StaticClass)#%d (0) { + } + [3]=> + object(StaticClass)#%d (0) { + } +} +-- Testing usort() with EmptyClass objects -- +bool(true) +array(4) { + [0]=> + object(EmptyClass)#%d (0) { + } + [1]=> + object(EmptyClass)#%d (0) { + } + [2]=> + object(EmptyClass)#%d (0) { + } + [3]=> + object(EmptyClass)#%d (0) { + } +} +-- Testing usort() with ChildClass objects -- +bool(true) +array(4) { + [0]=> + object(ChildClass)#%d (2) { + ["child_value"]=> + int(15) + ["pub_value"]=> + NULL + } + [1]=> + object(ChildClass)#%d (2) { + ["child_value"]=> + int(20) + ["pub_value"]=> + NULL + } + [2]=> + object(ChildClass)#%d (2) { + ["child_value"]=> + int(500) + ["pub_value"]=> + NULL + } + [3]=> + object(ChildClass)#%d (2) { + ["child_value"]=> + int(700) + ["pub_value"]=> + NULL + } +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_variation1.phpt b/ext/standard/tests/array/usort_variation1.phpt new file mode 100644 index 0000000000..73fdc08c05 --- /dev/null +++ b/ext/standard/tests/array/usort_variation1.phpt @@ -0,0 +1,236 @@ +--TEST-- +Test usort() function : usage variations - Pass different data types as $array_arg arg +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +//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 = << +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variations *** + +-- Iteration 1 -- + +Warning: usort() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: usort() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: usort() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: usort() expects parameter 1 to be array, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: usort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: usort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: usort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: usort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: usort() expects parameter 1 to be array, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: usort() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: usort() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: usort() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: usort() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: usort() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: usort() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: usort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: usort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 18 -- +bool(true) + +-- Iteration 19 -- + +Warning: usort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: usort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: usort() expects parameter 1 to be array, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: usort() expects parameter 1 to be array, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: usort() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: usort() expects parameter 1 to be array, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: usort() expects parameter 1 to be array, resource given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_variation10.phpt b/ext/standard/tests/array/usort_variation10.phpt new file mode 100644 index 0000000000..b343419ce1 --- /dev/null +++ b/ext/standard/tests/array/usort_variation10.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test usort() function : usage variations - duplicate keys and values +--FILE-- + $value2) { + return 1; + } + else + return -1; +} + +// Array with duplicate string and integer keys and values +$array_arg = array(0 => 2, "a" => 8, "d" => 9, + 3 => 3, 5 => 2, "o" => 6, + "z" => -99, 0 => 1, "z" => 3); + +echo "\n-- Array with duplicate keys --\n"; +var_dump( usort($array_arg, 'cmp') ); +var_dump($array_arg); + +// Array with default and assigned keys +$array_arg = array(0 => "Banana", 1 => "Mango", "Orange", 2 => "Apple", "Pineapple"); + +echo "\n-- Array with default/assigned keys --\n"; +var_dump( usort($array_arg, 'cmp') ); +var_dump($array_arg); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Array with duplicate keys -- +bool(true) +array(7) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(3) + [4]=> + int(6) + [5]=> + int(8) + [6]=> + int(9) +} + +-- Array with default/assigned keys -- +bool(true) +array(4) { + [0]=> + string(5) "Apple" + [1]=> + string(6) "Banana" + [2]=> + string(5) "Mango" + [3]=> + string(9) "Pineapple" +} +===DONE=== diff --git a/ext/standard/tests/array/usort_variation2.phpt b/ext/standard/tests/array/usort_variation2.phpt new file mode 100644 index 0000000000..70d21649ce --- /dev/null +++ b/ext/standard/tests/array/usort_variation2.phpt @@ -0,0 +1,242 @@ +--TEST-- +Test usort() function : usage variations - Pass different data types as $cmp_function arg +--FILE-- + 1, 1 => -1, 2 => 3, 3 => 10, 4 => 4, 5 => 2, 6 => 8, 7 => 5); + +// Get an unset variable +$unset_var = 10; +unset ($unset_var); + +// Get resource variable +$fp = fopen(__FILE__,'r'); + +// different values for $cmp_function +$inputs = array( + + // int data +/*1*/ 0, + 1, + 12345, + -2345, + + // float data +/*5*/ 10.5, + -10.5, + 10.1234567e8, + 10.7654321E-8, + .5, + + // array data +/*10*/ array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data +/*15*/ NULL, + null, + + // boolean data +/*17*/ true, + false, + TRUE, + FALSE, + + // empty data +/*21*/ "", + '', + + // string data + "string", + 'string', + + // object data +/*25*/ new MyClass(), + + // resource data + $fp, + + // undefined data + @$undefined_var, + + // unset data +/*28*/ @$unset_var, +); + +// loop through each element of $inputs to check the behavior of usort() +$iterator = 1; +foreach($inputs as $input) { + echo "\n-- Iteration $iterator --\n"; + var_dump( usort($array_arg, $input) ); + $iterator++; +}; + +//closing resource +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Iteration 1 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: usort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: usort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: usort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: usort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: usort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: usort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: usort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: usort() expects parameter 2 to be a valid callback, function 'string' not found or invalid function name in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: usort() expects parameter 2 to be a valid callback, function 'string' not found or invalid function name in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 26 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 27 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL + +-- Iteration 28 -- + +Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_variation3.phpt b/ext/standard/tests/array/usort_variation3.phpt new file mode 100644 index 0000000000..3758fe9c9a --- /dev/null +++ b/ext/standard/tests/array/usort_variation3.phpt @@ -0,0 +1,115 @@ +--TEST-- +Test usort() function : usage variations - diff. array values +--FILE-- + $value2) { + return -1; + } + else { + return 1; + } +} + +// different heredoc strings + +// single line heredoc string +$simple_heredoc = << 9, + 8.9 => 8, + 012 => 7, + 0x34 => 6, + + // string keys + 'key' => 5, //single quoted key + "two" => 4, //double quoted key + " " => 0, // space as key + + // bool keys + TRUE => 100, + FALSE => 25, + + // null keys + NULL => 35, + + // binary key + "a".chr(0)."b" => 45, + b"binary" => 30, + + //heredoc keys + $simple_heredoc => 75, + $multiline_heredoc => 200, + + // default key + 1, +); + +var_dump( usort($array_arg, 'cmp_function') ); +echo "\n-- Sorted array after usort() function call --\n"; +var_dump($array_arg); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** +bool(true) + +-- Sorted array after usort() function call -- +array(15) { + [0]=> + int(200) + [1]=> + int(100) + [2]=> + int(75) + [3]=> + int(45) + [4]=> + int(35) + [5]=> + int(30) + [6]=> + int(25) + [7]=> + int(9) + [8]=> + int(8) + [9]=> + int(7) + [10]=> + int(6) + [11]=> + int(5) + [12]=> + int(4) + [13]=> + int(1) + [14]=> + int(0) +} +===DONE=== diff --git a/ext/standard/tests/array/usort_variation4.phpt b/ext/standard/tests/array/usort_variation4.phpt new file mode 100644 index 0000000000..4de45cc616 --- /dev/null +++ b/ext/standard/tests/array/usort_variation4.phpt @@ -0,0 +1,155 @@ +--TEST-- +Test usort() function : usage variations - numeric data +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +// Int array +$int_values = array(0 => 3, 1 => 2, 3 => 100, + 4 => 150, 5 => 25, 6 => 350, + 7 => 0, 8 => -3, 9 => -1200); + +echo "\n-- Sorting Integer array --\n"; +var_dump( usort($int_values, 'cmp_function') ); +var_dump($int_values); + +// Octal array +$octal_values = array(0 => 056, 1 => 023, 2 => 090, + 3 => 015, 4 => -045, 5 => 01, 6 => -078); + +echo "\n-- Sorting Octal array --\n"; +var_dump( usort($octal_values, 'cmp_function') ); +var_dump($octal_values); + +// Hexadecimal array +$hex_values = array(0 => 0xAE, 1 => 0x2B, 2 => 0X10, + 3 => -0xCF, 4 => 0X12, 5 => -0XF2); + +echo "\n-- Sorting Hex array --\n"; +var_dump( usort($hex_values, 'cmp_function') ); +var_dump($hex_values); + +// Float array +$float_values = array( 0 => 10.2, 1 => 2.4, 2 => -3.4, + 3 => 0, 4 => 0.5, 5 => 7.3e3, 6 => -9.34E-2); + +echo "\n-- Sorting Float array --\n"; +var_dump( usort($float_values, 'cmp_function') ); +var_dump($float_values); + +// empty array +$empty_array = array(); + +echo "\n-- Sorting empty array --\n"; +var_dump( usort($empty_array, 'cmp_function') ); +var_dump($empty_array); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Sorting Integer array -- +bool(true) +array(9) { + [0]=> + int(-1200) + [1]=> + int(-3) + [2]=> + int(0) + [3]=> + int(2) + [4]=> + int(3) + [5]=> + int(25) + [6]=> + int(100) + [7]=> + int(150) + [8]=> + int(350) +} + +-- Sorting Octal array -- +bool(true) +array(7) { + [0]=> + int(-37) + [1]=> + int(-7) + [2]=> + int(0) + [3]=> + int(1) + [4]=> + int(13) + [5]=> + int(19) + [6]=> + int(46) +} + +-- Sorting Hex array -- +bool(true) +array(6) { + [0]=> + int(-242) + [1]=> + int(-207) + [2]=> + int(16) + [3]=> + int(18) + [4]=> + int(43) + [5]=> + int(174) +} + +-- Sorting Float array -- +bool(true) +array(7) { + [0]=> + float(-3.4) + [1]=> + float(-0.0934) + [2]=> + int(0) + [3]=> + float(0.5) + [4]=> + float(2.4) + [5]=> + float(10.2) + [6]=> + float(7300) +} + +-- Sorting empty array -- +bool(true) +array(0) { +} +===DONE=== diff --git a/ext/standard/tests/array/usort_variation5.phpt b/ext/standard/tests/array/usort_variation5.phpt new file mode 100644 index 0000000000..922321c237 --- /dev/null +++ b/ext/standard/tests/array/usort_variation5.phpt @@ -0,0 +1,143 @@ +--TEST-- +Test usort() function : usage variations - string data +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +// Different heredoc strings to be sorted +$empty_heredoc =<< ' ', 1 => 'test', 3 => 'Hello', 4 => 'HELLO', + 5 => '', 6 => '\t', 7 => '0', 8 => '123Hello', + 9 => '\'', 10 => '@#$%' +); + +echo "\n-- Sorting Single Quoted String values --\n"; +var_dump( usort($single_quoted_values, 'cmp_function') ); +var_dump($single_quoted_values); + +// Double quoted strings +$double_quoted_values = array( + 0 => " ", 1 => "test", 3 => "Hello", 4 => "HELLO", + 5 => "", 6 => "\t", 7 => "0", 8 => "123Hello", + 9 => "\"", 10 => "@#$%" +); + +echo "\n-- Sorting Double Quoted String values --\n"; +var_dump( usort($double_quoted_values, 'cmp_function') ); +var_dump($double_quoted_values); + +// Heredoc strings +$heredoc_values = array(0 => $empty_heredoc, 1 => $simple_heredoc1, + 2 => $simple_heredoc2, 3 => $multiline_heredoc); + +echo "\n-- Sorting Heredoc String values --\n"; +var_dump( usort($heredoc_values, 'cmp_function') ); +var_dump($heredoc_values); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Sorting Single Quoted String values -- +bool(true) +array(10) { + [0]=> + string(0) "" + [1]=> + string(1) " " + [2]=> + string(1) "'" + [3]=> + string(1) "0" + [4]=> + string(8) "123Hello" + [5]=> + string(4) "@#$%" + [6]=> + string(5) "HELLO" + [7]=> + string(5) "Hello" + [8]=> + string(2) "\t" + [9]=> + string(4) "test" +} + +-- Sorting Double Quoted String values -- +bool(true) +array(10) { + [0]=> + string(0) "" + [1]=> + string(1) " " + [2]=> + string(1) " " + [3]=> + string(1) """ + [4]=> + string(1) "0" + [5]=> + string(8) "123Hello" + [6]=> + string(4) "@#$%" + [7]=> + string(5) "HELLO" + [8]=> + string(5) "Hello" + [9]=> + string(4) "test" +} + +-- Sorting Heredoc String values -- +bool(true) +array(4) { + [0]=> + string(0) "" + [1]=> + string(7) "HEREDOC" + [2]=> + string(7) "Heredoc" + [3]=> + string(%d) "heredoc string with!@# and 123 +Test this!!!" +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_variation6.phpt b/ext/standard/tests/array/usort_variation6.phpt new file mode 100644 index 0000000000..ab4b3d410d --- /dev/null +++ b/ext/standard/tests/array/usort_variation6.phpt @@ -0,0 +1,139 @@ +--TEST-- +Test usort() function : usage variations - multi-dimensional arrays +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +$array_args = array( + 0 => array(2, 10, -1), + 1 => array(100), + 2 => array(), + 3 => array(0), + 4 => array(-1), + 5 => array(-9, 34, 54, 0, 20), + 6 => array(''), + 7 => array("apple", "Apple", "APPLE", "aPPle", "aPpLe") +); + +$temp_array = $array_args; + +echo "\n-- Pass usort() a two-dimensional array --\n"; +// sorting array_arg as whole array +var_dump( usort($temp_array, 'cmp_function') ); + +echo "-- Array after call to usort() --\n"; +var_dump($temp_array); + +echo "\n-- Pass usort() a sub-array --\n"; +var_dump( usort($array_args[5], 'cmp_function') ); + +echo "-- Array after call to usort() --\n"; +var_dump($array_args[5]); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Pass usort() a two-dimensional array -- +bool(true) +-- Array after call to usort() -- +array(8) { + [0]=> + array(0) { + } + [1]=> + array(1) { + [0]=> + int(-1) + } + [2]=> + array(1) { + [0]=> + string(0) "" + } + [3]=> + array(1) { + [0]=> + int(0) + } + [4]=> + array(1) { + [0]=> + int(100) + } + [5]=> + array(3) { + [0]=> + int(2) + [1]=> + int(10) + [2]=> + int(-1) + } + [6]=> + array(5) { + [0]=> + int(-9) + [1]=> + int(34) + [2]=> + int(54) + [3]=> + int(0) + [4]=> + int(20) + } + [7]=> + array(5) { + [0]=> + string(5) "apple" + [1]=> + string(5) "Apple" + [2]=> + string(5) "APPLE" + [3]=> + string(5) "aPPle" + [4]=> + string(5) "aPpLe" + } +} + +-- Pass usort() a sub-array -- +bool(true) +-- Array after call to usort() -- +array(5) { + [0]=> + int(-9) + [1]=> + int(0) + [2]=> + int(20) + [3]=> + int(34) + [4]=> + int(54) +} +===DONE=== diff --git a/ext/standard/tests/array/usort_variation7.phpt b/ext/standard/tests/array/usort_variation7.phpt new file mode 100644 index 0000000000..e567341b1a --- /dev/null +++ b/ext/standard/tests/array/usort_variation7.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test usort() function : usage variations - Anonymous comparison function +--FILE-- + $value2) {return 1;} else{return -1;}'; + +$array_arg = array(0 => 100, 1 => 3, 2 => -70, 3 => 24, 4 => 90); + +echo "\n-- Anonymous 'cmp_function' with parameters passed by value --\n"; +var_dump( usort($array_arg, create_function('$value1, $value2',$cmp_function) ) ); +var_dump($array_arg); + +$array_arg = array("b" => "Banana", "m" => "Mango", "a" => "Apple", "p" => "Pineapple"); + +echo "\n-- Anonymous 'cmp_function' with parameters passed by reference --\n"; +var_dump( usort($array_arg, create_function('&$value1, &$value2', $cmp_function) ) ); +var_dump($array_arg); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Anonymous 'cmp_function' with parameters passed by value -- +bool(true) +array(5) { + [0]=> + int(-70) + [1]=> + int(3) + [2]=> + int(24) + [3]=> + int(90) + [4]=> + int(100) +} + +-- Anonymous 'cmp_function' with parameters passed by reference -- +bool(true) +array(4) { + [0]=> + string(5) "Apple" + [1]=> + string(6) "Banana" + [2]=> + string(5) "Mango" + [3]=> + string(9) "Pineapple" +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_variation8.phpt b/ext/standard/tests/array/usort_variation8.phpt new file mode 100644 index 0000000000..87107f8009 --- /dev/null +++ b/ext/standard/tests/array/usort_variation8.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test usort() function : usage variations - use built in functions as $cmp_function arg +--FILE-- + "Banana", "m" => "Mango", "a" => "apple", + "p" => "Pineapple", "o" => "orange"); + +// Testing library functions as comparison function +echo "\n-- Testing usort() with built-in 'cmp_function': strcasecmp() --\n"; +$temp_array1 = $array_arg; +var_dump( usort($temp_array1, 'strcasecmp') ); +var_dump($temp_array1); + +echo "\n-- Testing usort() with built-in 'cmp_function': strcmp() --\n"; +$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-- +*** Testing usort() : usage variation *** + +-- Testing usort() with built-in 'cmp_function': strcasecmp() -- +bool(true) +array(5) { + [0]=> + string(5) "apple" + [1]=> + string(6) "Banana" + [2]=> + string(5) "Mango" + [3]=> + string(6) "orange" + [4]=> + string(9) "Pineapple" +} + +-- Testing usort() with built-in 'cmp_function': strcmp() -- +bool(true) +array(5) { + [0]=> + string(6) "Banana" + [1]=> + string(5) "Mango" + [2]=> + string(9) "Pineapple" + [3]=> + string(5) "apple" + [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=== \ No newline at end of file diff --git a/ext/standard/tests/array/usort_variation9.phpt b/ext/standard/tests/array/usort_variation9.phpt new file mode 100644 index 0000000000..6a067992e7 --- /dev/null +++ b/ext/standard/tests/array/usort_variation9.phpt @@ -0,0 +1,66 @@ +--TEST-- +Test usort() function : usage variations - referenced variables +--FILE-- + $value2) { + return 1; + } + else { + return -1; + } +} + +// different variables which are used as elements of $array_arg +$value1 = -5; +$value2 = 100; +$value3 = 0; +$value4 = &$value1; + +// array_args an array containing elements with reference variables +$array_arg = array( + 0 => 10, + 1 => &$value4, + 2 => &$value2, + 3 => 200, + 4 => &$value3, +); + +echo "\n-- Sorting \$array_arg containing different references --\n"; +var_dump( usort($array_arg, 'cmp_function') ); +var_dump($array_arg); +?> +===DONE=== +--EXPECTF-- +*** Testing usort() : usage variation *** + +-- Sorting $array_arg containing different references -- +bool(true) +array(5) { + [0]=> + &int(-5) + [1]=> + &int(0) + [2]=> + int(10) + [3]=> + &int(100) + [4]=> + int(200) +} +===DONE===