From: Ant Phillips Date: Tue, 2 Dec 2008 13:29:17 +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: BEFORE_HEAD_NS_CHANGES_MERGE~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba7bc0ace477f35d645c40adcb2d6d10d321872d;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..488b04e57c --- /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) { + [u"bobv"]=> + int(1) + [u"val"]=> + int(1) + [u"val6"]=> + int(1) +} + +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_assoc_error.phpt b/ext/standard/tests/array/array_diff_assoc_error.phpt index 1aa7a08bc5..211907c726 100644 --- a/ext/standard/tests/array/array_diff_assoc_error.phpt +++ b/ext/standard/tests/array/array_diff_assoc_error.phpt @@ -38,4 +38,4 @@ NULL Warning: array_diff_assoc(): at least 2 parameters are required, 1 given in %s on line %d NULL -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_error.phpt b/ext/standard/tests/array/array_diff_key_error.phpt new file mode 100644 index 0000000000..90168f5de6 --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_error.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_diff_key() function : error conditions +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); + +// Testing array_diff_key with one less than the expected number of arguments +echo "\n-- Testing array_diff_key() function with less than expected no. of arguments --\n"; +var_dump( array_diff_key($array1) ); + +// Testing array_diff_key with no arguments +echo "\n-- Testing array_diff_key() function with no arguments --\n"; +var_dump( array_diff_key() ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : error conditions *** + +-- Testing array_diff_key() function with less than expected no. of arguments -- + +Warning: array_diff_key(): at least 2 parameters are required, 1 given in %s on line %d +NULL + +-- Testing array_diff_key() function with no arguments -- + +Warning: array_diff_key(): at least 2 parameters are required, 0 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/array/array_diff_key_variation1.phpt b/ext/standard/tests/array/array_diff_key_variation1.phpt index b322a5fa93..52b703fb77 100644 --- a/ext/standard/tests/array/array_diff_key_variation1.phpt +++ b/ext/standard/tests/array/array_diff_key_variation1.phpt @@ -1,89 +1,310 @@ --TEST-- -array_diff_key() : type variations +Test array_diff_key() function : usage variation - Passing unexpected values to first argument --FILE-- 'a', 2 => 'b', 3 => 'c', 'key1' => 'value'); -$arr2 = array(1.00 => 'a', 2.00 => 'b', 3.00 => 'c', 'key2' => 'value'); -$arr3 = array('1' => 'a', '2' => 'b', '3' => 'c', 'key3' => 'value'); -$arr4 = array('1.00' => 'a', '2.00' => 'b', '3.00' => 'c', 'key4' => 'value'); //$arr4 looks different to the other three arrays. -print "Result of comparing integers and floating point value:\n"; //1 and 1.00 are treated as the same thing -print_r(array_diff_key($arr1, $arr2)); -print_r(array_diff_key($arr2, $arr1)); -print "Result of comparing integers and strings containing an integers:\n"; //1 and the string 1 are treated as the same thing -print_r(array_diff_key($arr1, $arr3)); -print_r(array_diff_key($arr3, $arr1)); -print "Result of comparing integers and strings containing floating points:\n"; //1 and the string 1.00 are not treated as the same thing -print_r(array_diff_key($arr1, $arr4)); -print_r(array_diff_key($arr4, $arr1)); -print "Result of comparing floating points and strings containing integers:\n"; -print_r(array_diff_key($arr2, $arr3)); //1.00 and the string 1 are treated as the same thing -print_r(array_diff_key($arr3, $arr2)); -print "Result of comparing strings containing integers and strings containing floating points:\n"; //the strings 1 and 1.00 are not treated as the same thing. -print_r(array_diff_key($arr3, $arr4)); -print_r(array_diff_key($arr4, $arr3)); +/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...]) + * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments. + * Source code: ext/standard/array.c + */ + +echo "*** Testing array_diff_key() : usage variation ***\n"; + +// Initialise function arguments not being substituted (if any) +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array3 = array(1, 2, 3, 4, 5); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for arr1 +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_key($value, $array2) ); + var_dump( array_diff_key($value, $array2, $array3) ); +}; + +fclose($fp); ?> ---EXPECT-- -Result of comparing integers and floating point value: -Array -( - [key1] => value -) -Array -( - [key2] => value -) -Result of comparing integers and strings containing an integers: -Array -( - [key1] => value -) -Array -( - [key3] => value -) -Result of comparing integers and strings containing floating points: -Array -( - [1] => a - [2] => b - [3] => c - [key1] => value -) -Array -( - [1.00] => a - [2.00] => b - [3.00] => c - [key4] => value -) -Result of comparing floating points and strings containing integers: -Array -( - [key2] => value -) -Array -( - [key3] => value -) -Result of comparing strings containing integers and strings containing floating points: -Array -( - [1] => a - [2] => b - [3] => c - [key3] => value -) -Array -( - [1.00] => a - [2.00] => b - [3.00] => c - [key4] => value -) +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +--int 0-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #1 is not an array in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_variation2.phpt b/ext/standard/tests/array/array_diff_key_variation2.phpt new file mode 100644 index 0000000000..737ee2e57f --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation2.phpt @@ -0,0 +1,311 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing unexpected values to second argument +--FILE-- + 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); +$array3 = array(1, 2, 3, 4, 5); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_key($array1, $value) ); + var_dump( array_diff_key($array1, $value, $array3) ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +--int 0-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL + +Warning: array_diff_key(): Argument #2 is not an array in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_variation3.phpt b/ext/standard/tests/array/array_diff_key_variation3.phpt new file mode 100644 index 0000000000..28f4c05529 --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation3.phpt @@ -0,0 +1,232 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing unexpected values to third optional argument +--FILE-- + 1, 'red' => 2, 'green' => 3, 'purple' => 4); +$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//resource variable +$fp = fopen(__FILE__, "r"); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = << 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // resource data + 'resource' => $fp, +); + +// loop through each element of the array for arr1 + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_key($array1, $array2, $value) ); +}; + +fclose($fp); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +--int 0-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--int 1-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--int 12345-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--int -12345-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--float 10.5-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--float -10.5-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--float 12.3456789000e10-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--float -12.3456789000e10-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--float .5-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase NULL-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase null-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase true-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--lowercase false-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase TRUE-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--uppercase FALSE-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--empty string DQ-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--empty string SQ-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--string DQ-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--string SQ-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--mixed case string-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--heredoc-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--instance of classWithToString-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--instance of classWithoutToString-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--undefined var-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--unset var-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL + +--resource-- + +Warning: array_diff_key(): Argument #3 is not an array in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_variation4.phpt b/ext/standard/tests/array/array_diff_key_variation4.phpt new file mode 100644 index 0000000000..d64f990468 --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation4.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing integer indexed array +--FILE-- + '-07', 0xA => '0xA'); + +$input_arrays = array( + 'decimal indexed' => array(10 => '10', '-17' => '-17'), + 'octal indexed' => array(-011 => '-011', 012 => '012'), + 'hexa indexed' => array(0x12 => '0x12', -0x7 => '-0x7', ), +); + +// loop through each element of the array for arr1 +foreach($input_arrays as $key =>$value) { + echo "\n--$key--\n"; + var_dump( array_diff_key($input_array, $value) ); + var_dump( array_diff_key($value, $input_array) ); +} +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +--decimal indexed-- +array(1) { + [-7]=> + unicode(3) "-07" +} +array(1) { + [-17]=> + unicode(3) "-17" +} + +--octal indexed-- +array(1) { + [-7]=> + unicode(3) "-07" +} +array(1) { + [-9]=> + unicode(4) "-011" +} + +--hexa indexed-- +array(1) { + [10]=> + unicode(3) "0xA" +} +array(1) { + [18]=> + unicode(4) "0x12" +} +===DONE=== + diff --git a/ext/standard/tests/array/array_diff_key_variation5.phpt b/ext/standard/tests/array/array_diff_key_variation5.phpt new file mode 100644 index 0000000000..ba98a2e68d --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation5.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing float indexed array +--FILE-- + '0', 10 => '10', -10 => '-10', 20 =>'20', -20 => '-20'); +$float_indx_array = array(0.0 => '0.0', 10.5 => '10.5', -10.5 => '-10.5', 0.5 => '0.5'); + +echo "\n-- Testing array_diff_key() function with float indexed array --\n"; +// loop through each element of the array for arr1 +var_dump( array_diff_key($input_array, $float_indx_array) ); +var_dump( array_diff_key($float_indx_array, $input_array) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +-- Testing array_diff_key() function with float indexed array -- +array(2) { + [20]=> + unicode(2) "20" + [-20]=> + unicode(3) "-20" +} +array(0) { +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_variation6.phpt b/ext/standard/tests/array/array_diff_key_variation6.phpt new file mode 100644 index 0000000000..eec9934935 --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation6.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing boolean indexed array +--FILE-- + '0', 1 => '1', -10 => '-10', 'true' => 1, 'false' => 0); +$boolean_indx_array = array(true => 'boolt', false => 'boolf', TRUE => 'boolT', FALSE => 'boolF'); + +echo "\n-- Testing array_diff_key() function with boolean indexed array --\n"; +// loop through each element of the array for arr1 +var_dump( array_diff_key($input_array, $boolean_indx_array) ); +var_dump( array_diff_key($boolean_indx_array, $input_array) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +-- Testing array_diff_key() function with boolean indexed array -- +array(3) { + [-10]=> + unicode(3) "-10" + [u"true"]=> + int(1) + [u"false"]=> + int(0) +} +array(0) { +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_variation7.phpt b/ext/standard/tests/array/array_diff_key_variation7.phpt new file mode 100644 index 0000000000..76b747c479 --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation7.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing null,unset and undefined variable indexed array +--FILE-- + '10', "" => 'empty'); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$input_arrays = array( + 'null indexed' => array(NULL => 'null 1', null => 'null 2'), + 'undefined indexed' => array(@$undefined_var => 'undefined'), + 'unset indexed' => array(@$unset_var => 'unset'), +); + +foreach($input_arrays as $key =>$value) { + echo "\n--$key--\n"; + // loop through each element of the array for arr1 + var_dump( array_diff_key($input_array, $value) ); + var_dump( array_diff_key($value, $input_array) ); +} +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +--null indexed-- +array(1) { + [10]=> + unicode(2) "10" +} +array(0) { +} + +--undefined indexed-- +array(1) { + [10]=> + unicode(2) "10" +} +array(0) { +} + +--unset indexed-- +array(1) { + [10]=> + unicode(2) "10" +} +array(0) { +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_key_variation8.phpt b/ext/standard/tests/array/array_diff_key_variation8.phpt new file mode 100644 index 0000000000..f8106d8af3 --- /dev/null +++ b/ext/standard/tests/array/array_diff_key_variation8.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test array_diff_key() function : usage variation - Passing multi-dimensional array +--FILE-- + array('blue' => 1, 'red' => 2), + + 'second' => array('yellow' => 7), + + 'third' => array(0 => 'zero'), +); + +$array2 = array ( + + 'first' => array('blue' => 1, 'red' => 2,), + + 'second' => array('cyan' => 8), + + 'fourth' => array(2 => 'two'), +); + +echo "\n-- Testing array_diff_key() function with multi dimensional array --\n"; +var_dump( array_diff_key($array1, $array2) ); +var_dump( array_diff_key($array2, $array1) ); +?> +===DONE=== +--EXPECTF-- +*** Testing array_diff_key() : usage variation *** + +-- Testing array_diff_key() function with multi dimensional array -- +array(1) { + [u"third"]=> + array(1) { + [0]=> + unicode(4) "zero" + } +} +array(1) { + [u"fourth"]=> + array(1) { + [2]=> + unicode(3) "two" + } +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_diff_uassoc_error.phpt b/ext/standard/tests/array/array_diff_uassoc_error.phpt index a2f9820442..0f9f82464c 100644 --- a/ext/standard/tests/array/array_diff_uassoc_error.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_error.phpt @@ -27,7 +27,6 @@ function key_compare_func($a, $b) //Test array_diff_uassoc with one more than the expected number of arguments echo "\n-- Testing array_diff_uassoc() function with more than expected no. of arguments --\n"; - var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) ); var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) ); 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_diff_ukey_variation3.phpt b/ext/standard/tests/array/array_diff_ukey_variation3.phpt index 309dae45a4..f7a2ea8620 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation3.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation3.phpt @@ -3,7 +3,7 @@ Test array_diff_ukey() function : usage variation - Passing unexpected values to --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..796a9be9cd --- /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]=> + unicode(6) "simple" + [u"strv1"]=> + unicode(6) "simple" + [4]=> + unicode(6) "simple" + [u"simple"]=> + unicode(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) { + [u"Resource id #%d"]=> + unicode(6) "simple" + [u"Class A object"]=> + unicode(6) "simple" + [u"simple"]=> + unicode(6) "simple" + [u"Array"]=> + unicode(6) "simple" + [2]=> + unicode(6) "simple" + [u""]=> + unicode(6) "simple" + [u"2.4"]=> + unicode(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..df7f389ebb --- /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) { + [u"one"]=> + unicode(6) "simple" + [u"two"]=> + unicode(6) "simple" +} + +-- Testing array_fill_keys() function with reference keys -- +array(2) { + [u"one"]=> + unicode(6) "simple" + [u"simple"]=> + unicode(6) "simple" +} +array(2) { + [u"one"]=> + unicode(6) "simple" + [u"simple"]=> + unicode(6) "simple" +} + +-- Testing array_fill_keys() function with reference array input -- +array(2) { + [u"one"]=> + unicode(3) "bob" + [u"two"]=> + unicode(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..09cfadc0e0 --- /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) { + [u"one"]=> + resource(%d) of type (stream) + [u"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..0a1659f135 --- /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) { + [u"one"]=> + float(2.4) +} + +-- Testing array_fill_keys() function with null -- +array(1) { + [u"one"]=> + NULL +} + +-- Testing array_fill_keys() function with object -- +array(1) { + [u"one"]=> + object(classA)#%d (0) { + } +} + +-- Testing array_fill_keys() function with boolean -- +array(1) { + [u"one"]=> + bool(false) +} + +-- Testing array_fill_keys() function with resource -- +array(1) { + [u"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) { + [u"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 be308a48d3..36b99028e6 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 0995993288..ccaaf50217 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_variation2.phpt b/ext/standard/tests/array/array_intersect_key_variation2.phpt index 9137a602d9..3c33debebe 100644 --- a/ext/standard/tests/array/array_intersect_key_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_key_variation2.phpt @@ -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_variation3.phpt b/ext/standard/tests/array/array_intersect_key_variation3.phpt index 2eaf7213c6..8fd3d3c77f 100644 --- a/ext/standard/tests/array/array_intersect_key_variation3.phpt +++ b/ext/standard/tests/array/array_intersect_key_variation3.phpt @@ -92,7 +92,6 @@ $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, $array2, $value) ); diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt index 7089e63475..b6a9497082 100644 --- a/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt +++ b/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt @@ -22,7 +22,7 @@ class MyClass public function class_compare_func($a, $b) { return strcasecmp($a, $b); } - + } echo "\n-- Testing array_intersect_uassoc() function using class with static method as callback --\n"; 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 abb2407792..d8fc8fe8a5 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 d288b57b6c..326b6f514c 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..134836ecf7 --- /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]=> + unicode(10) "original.0" + [1]=> + unicode(10) "original.1" +} +array(2) { + [0]=> + &unicode(7) "changed" + [1]=> + unicode(10) "original.1" +} \ No newline at end of file diff --git a/ext/standard/tests/array/array_multisort_basic1.phpt b/ext/standard/tests/array/array_multisort_basic1.phpt index 3bdf63a925..97475191bd 100644 --- a/ext/standard/tests/array/array_multisort_basic1.phpt +++ b/ext/standard/tests/array/array_multisort_basic1.phpt @@ -31,30 +31,30 @@ var_dump($ar2); -- Testing array_multisort() function with all normal arguments -- bool(true) array(3) { - [%u|b%"row2"]=> + [u"row2"]=> int(1) - [%u|b%"row3"]=> + [u"row3"]=> int(1) - [%u|b%"row1"]=> + [u"row1"]=> int(2) } array(3) { - [%u|b%"row2"]=> - %unicode|string%(2) "aa" - [%u|b%"row3"]=> - %unicode|string%(1) "1" - [%u|b%"row1"]=> + [u"row2"]=> + unicode(2) "aa" + [u"row3"]=> + unicode(1) "1" + [u"row1"]=> int(2) } -- Testing array_multisort() function with one argument -- bool(true) array(3) { - [%u|b%"row3"]=> - %unicode|string%(1) "1" - [%u|b%"row2"]=> - %unicode|string%(2) "aa" - [%u|b%"row1"]=> + [u"row3"]=> + unicode(1) "1" + [u"row2"]=> + unicode(2) "aa" + [u"row1"]=> int(2) } ===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/array/array_multisort_basic2.phpt b/ext/standard/tests/array/array_multisort_basic2.phpt index 1ce594c17b..d51283c316 100644 --- a/ext/standard/tests/array/array_multisort_basic2.phpt +++ b/ext/standard/tests/array/array_multisort_basic2.phpt @@ -30,14 +30,14 @@ array(3) { int(1) [1]=> int(1) - [%u|b%"strkey"]=> + [u"strkey"]=> int(2) } array(3) { [0]=> - %unicode|string%(2) "aa" + unicode(2) "aa" [1]=> - %unicode|string%(1) "1" + unicode(1) "1" [2]=> int(2) } diff --git a/ext/standard/tests/array/array_multisort_variation5.phpt b/ext/standard/tests/array/array_multisort_variation5.phpt index d220810785..ad7a25dae4 100644 --- a/ext/standard/tests/array/array_multisort_variation5.phpt +++ b/ext/standard/tests/array/array_multisort_variation5.phpt @@ -50,4 +50,4 @@ array(3) { [2]=> int(2) } -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation6.phpt b/ext/standard/tests/array/array_multisort_variation6.phpt index af209713fc..c3da621662 100644 --- a/ext/standard/tests/array/array_multisort_variation6.phpt +++ b/ext/standard/tests/array/array_multisort_variation6.phpt @@ -50,4 +50,4 @@ array(3) { [2]=> unicode(2) "aa" } -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation7.phpt b/ext/standard/tests/array/array_multisort_variation7.phpt index 106f6002be..ff285b1323 100644 --- a/ext/standard/tests/array/array_multisort_variation7.phpt +++ b/ext/standard/tests/array/array_multisort_variation7.phpt @@ -53,10 +53,10 @@ array(10) { array(0) { } [u"instance of classWithToString"]=> - object(classWithToString)#%d (0) { + object(classWithToString)#1 (0) { } [u"instance of classWithoutToString"]=> - object(classWithoutToString)#%d (0) { + object(classWithoutToString)#2 (0) { } [u"lowercase true"]=> bool(true) @@ -65,4 +65,4 @@ array(10) { [u"string DQ"]=> unicode(6) "string" } -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation8.phpt b/ext/standard/tests/array/array_multisort_variation8.phpt index 9a5ae571b4..3ee3d9a56d 100644 --- a/ext/standard/tests/array/array_multisort_variation8.phpt +++ b/ext/standard/tests/array/array_multisort_variation8.phpt @@ -54,7 +54,7 @@ array(10) { [u"undefined var"]=> NULL [u"instance of classWithoutToString"]=> - object(classWithoutToString)#%d (0) { + object(classWithoutToString)#2 (0) { } [u"float -10.5"]=> float(-10.5) @@ -66,9 +66,9 @@ array(10) { array(0) { } [u"instance of classWithToString"]=> - object(classWithToString)#%d (0) { + object(classWithToString)#1 (0) { } [u"string DQ"]=> unicode(6) "string" } -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation9.phpt b/ext/standard/tests/array/array_multisort_variation9.phpt index 4713bbdb1f..ea78774270 100644 --- a/ext/standard/tests/array/array_multisort_variation9.phpt +++ b/ext/standard/tests/array/array_multisort_variation9.phpt @@ -67,12 +67,12 @@ array(10) { array(0) { } [u"instance of classWithoutToString"]=> - object(classWithoutToString)#%d (0) { + object(classWithoutToString)#2 (0) { } [u"lowercase true"]=> bool(true) [u"instance of classWithToString"]=> - object(classWithToString)#%d (0) { + object(classWithToString)#1 (0) { } } ===DONE=== \ 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_product_error.phpt b/ext/standard/tests/array/array_product_error.phpt index b8465bc605..2d12a44ffe 100644 --- a/ext/standard/tests/array/array_product_error.phpt +++ b/ext/standard/tests/array/array_product_error.phpt @@ -42,4 +42,4 @@ NULL Warning: array_product() expects parameter 1 to be array, Unicode string given in %sarray_product_error.php on line %d NULL -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/standard/tests/array/array_product_variation2.phpt b/ext/standard/tests/array/array_product_variation2.phpt index 94a54505e2..c4c47d86a2 100644 --- a/ext/standard/tests/array/array_product_variation2.phpt +++ b/ext/standard/tests/array/array_product_variation2.phpt @@ -1,5 +1,5 @@ --TEST-- -Test array_product() function : variation - using a keyed array +Test array_product() function : variation --FILE-- 2, "janet" => 5)) ); ?> ===DONE=== --EXPECTF-- *** Testing array_product() : variations *** --- Testing array_product() function with a keyed array -- +-- Testing array_product() function with a keyed array array -- int(10) ===DONE=== diff --git a/ext/standard/tests/array/array_product_variation3.phpt b/ext/standard/tests/array/array_product_variation3.phpt index 87b7be756a..dc8609ebd8 100644 --- a/ext/standard/tests/array/array_product_variation3.phpt +++ b/ext/standard/tests/array/array_product_variation3.phpt @@ -1,5 +1,5 @@ --TEST-- -Test array_product() function : variation - negative numbers +Test array_product() function : variation --FILE-- "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") ); 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..d68372f827 --- /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, Unicode 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 01fcc0bc07..f3c93265ed 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-- ---EXPECT-- -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) { -} +--EXPECTF-- +*** 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, Unicode string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: array_slice() expects parameter 1 to be array, Unicode string given in %s on line %d +NULL + +-- Iteration 18 -- array(0) { } -unicode(3) "foo" + +-- Iteration 19 -- + +Warning: array_slice() expects parameter 1 to be array, Unicode string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: array_slice() expects parameter 1 to be array, Unicode string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: array_slice() expects parameter 1 to be array, Unicode 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..0c36a8e6f5 --- /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]=> + unicode(4) "four" + [u"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..561a60dd97 --- /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) { + [u"one"]=> + unicode(3) "one" + [3]=> + unicode(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 7fc6ec82e0..998d6b99d8 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 index 01d549672c..72405acf0d 100644 --- a/ext/standard/tests/array/array_values_variation7.phpt +++ b/ext/standard/tests/array/array_values_variation7.phpt @@ -26,7 +26,7 @@ var_dump(array_values($input)); echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing array_values() : usage variations *** -- $input argument: -- @@ -52,4 +52,4 @@ array(4) { [3]=> unicode(4) "zero" } -Done +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..ad1e003cf5 --- /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) { + [u"o"]=> + unicode(6) "orange" + [u"l"]=> + unicode(5) "lemon" + [u"b"]=> + unicode(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) { + [u"o"]=> + unicode(6) "orange" + [u"l"]=> + unicode(5) "lemon" + [u"b"]=> + unicode(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) { + [u"o"]=> + unicode(6) "orange" + [u"l"]=> + unicode(5) "lemon" + [u"b"]=> + unicode(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..6dca4954dc --- /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 __tounicode() { + 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..215e59d9e1 --- /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 __tounicode() { + 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 dab0ee5159..0ceba736ae 100644 --- a/ext/standard/tests/array/arsort_variation3.phpt +++ b/ext/standard/tests/array/arsort_variation3.phpt @@ -10,7 +10,7 @@ Test arsort() function : usage variations - sort integer/float values /* * Testing arsort() by providing different integer/float value arrays for $array argument with following values - * 1. flag value as default + * 1. flag value as defualt * 2. SORT_REGULAR - compare items normally * 3. SORT_NUMERIC - compare items numerically */ @@ -59,7 +59,7 @@ foreach ($various_arrays as $array) { echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing arsort() : usage variations *** -- Testing arsort() by supplying various integer/float arrays -- @@ -273,7 +273,7 @@ array(11) { bool(true) array(7) { [2]=> - %s(2147483648) + float(2147483648) [1]=> int(2147483647) [6]=> @@ -283,15 +283,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 +301,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 +319,8 @@ array(7) { [3]=> int(-2147483647) [4]=> - %s(-2147483648) + float(-2147483648) [7]=> - %s(-2147483649) + float(-2147483649) } -Done +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..f773bbf2aa --- /dev/null +++ b/ext/standard/tests/array/bug44181.phpt @@ -0,0 +1,18 @@ +--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-- +unicode(%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..076b409f58 --- /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-- +unicode(%d) "original.foo" +Done + diff --git a/ext/standard/tests/array/compact_variation1.phpt b/ext/standard/tests/array/compact_variation1.phpt index 712ea738fd..c41126e732 100644 --- a/ext/standard/tests/array/compact_variation1.phpt +++ b/ext/standard/tests/array/compact_variation1.phpt @@ -32,6 +32,33 @@ echo "Done"; --EXPECTF-- *** Testing compact() : usage variations - arrays containg references *** +Warning: compact(): recursion detected in %s on line %d +array(1) { + ["a"]=> + int(1) +} + +Warning: compact(): recursion detected in %s on line %d + +Warning: compact(): recursion detected in %s on line %d + +Warning: compact(): recursion detected in %s on line %d + +Warning: compact(): recursion detected in %s on line %d +array(2) { + ["a"]=> + int(1) + ["b"]=> + int(2) +} +array(1) { + ["c"]=> + int(3) +} +Done +--UEXPECTF-- +*** Testing compact() : usage variations - arrays containg references *** + Warning: compact(): recursion detected in %s on line %d array(1) { [u"a"]=> @@ -55,4 +82,4 @@ array(1) { [u"c"]=> int(3) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/compact_variation2.phpt b/ext/standard/tests/array/compact_variation2.phpt new file mode 100644 index 0000000000..66b6bdbf76 --- /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) { + [u"b"]=> + unicode(3) "f.b" + [u"c"]=> + unicode(3) "f.c" +} +array(2) { + [u"b"]=> + unicode(3) "f.b" + [u"c"]=> + unicode(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/current_basic.phpt b/ext/standard/tests/array/current_basic.phpt index adfe7da053..3ef4740392 100644 --- a/ext/standard/tests/array/current_basic.phpt +++ b/ext/standard/tests/array/current_basic.phpt @@ -23,7 +23,7 @@ next($array); var_dump(current($array)); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing current() : basic functionality *** unicode(4) "zero" unicode(3) "one" diff --git a/ext/standard/tests/array/current_variation1.phpt b/ext/standard/tests/array/current_variation1.phpt index 24accd4a6f..8acbcf3c85 100644 --- a/ext/standard/tests/array/current_variation1.phpt +++ b/ext/standard/tests/array/current_variation1.phpt @@ -198,8 +198,6 @@ Warning: current() expects parameter 1 to be array, Unicode string given in %s o NULL -- Iteration 21 -- - -Warning: current() expects parameter 1 to be array, object given in %s on line %d NULL -- Iteration 22 -- @@ -217,3 +215,4 @@ NULL Warning: current() expects parameter 1 to be array, resource given in %s on line %d NULL ===DONE=== + diff --git a/ext/standard/tests/array/current_variation3.phpt b/ext/standard/tests/array/current_variation3.phpt index 1cfd802a56..8c28be4cd7 100644 --- a/ext/standard/tests/array/current_variation3.phpt +++ b/ext/standard/tests/array/current_variation3.phpt @@ -30,7 +30,7 @@ echo "\$array2: "; var_dump(current($array2)); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing current() : usage variations *** -- Initial position of internal pointer -- diff --git a/ext/standard/tests/array/current_variation4.phpt b/ext/standard/tests/array/current_variation4.phpt index 5f42fa45de..e1260f11f3 100644 --- a/ext/standard/tests/array/current_variation4.phpt +++ b/ext/standard/tests/array/current_variation4.phpt @@ -46,7 +46,7 @@ var_dump(current($multi_array[3][3][3])); var_dump(current($multi_array[3][3][3][1])); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing current() : usage variations *** -- Two Dimensional Array -- diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt index e9c05d5077..58a552f094 100644 --- a/ext/standard/tests/array/each_basic.phpt +++ b/ext/standard/tests/array/each_basic.phpt @@ -30,7 +30,7 @@ var_dump(each($arr)); echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing each() : basic functionality *** -- Passed array: -- @@ -71,4 +71,4 @@ array(4) { -- Passed the end of array: -- bool(false) -Done +Done \ 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 489681a5fa..0806bee674 100644 --- a/ext/standard/tests/array/each_error.phpt +++ b/ext/standard/tests/array/each_error.phpt @@ -40,3 +40,4 @@ NULL Warning: each() expects exactly 1 parameter, 2 given in %s on line %d NULL Done + diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt index fbb5feebfe..eb12212e3d 100644 --- a/ext/standard/tests/array/each_variation2.phpt +++ b/ext/standard/tests/array/each_variation2.phpt @@ -245,4 +245,4 @@ array(4) { [u"key"]=> int(0) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt index ff1791aa71..0333c8880f 100644 --- a/ext/standard/tests/array/each_variation3.phpt +++ b/ext/standard/tests/array/each_variation3.phpt @@ -104,7 +104,7 @@ foreach($inputs as $key => $input) { echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing each() : usage variations *** -- Iteration 1: int data -- @@ -250,4 +250,4 @@ array(4) { [u"key"]=> unicode(0) "" } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt index 765159441b..f05a7c9aed 100644 --- a/ext/standard/tests/array/each_variation4.phpt +++ b/ext/standard/tests/array/each_variation4.phpt @@ -86,4 +86,4 @@ array(3) { [2]=> unicode(3) "two" } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/each_variation5.phpt b/ext/standard/tests/array/each_variation5.phpt index 09bf3f4f6d..495927494b 100644 --- a/ext/standard/tests/array/each_variation5.phpt +++ b/ext/standard/tests/array/each_variation5.phpt @@ -33,7 +33,7 @@ var_dump( each($arr[2])); echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing each() : usage variations *** -- Pass each() a two-dimensional array -- @@ -93,4 +93,4 @@ array(4) { [u"key"]=> int(0) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt index 5fa5460188..e2b49a5728 100644 --- a/ext/standard/tests/array/each_variation6.phpt +++ b/ext/standard/tests/array/each_variation6.phpt @@ -28,7 +28,7 @@ echo key($arr) . " => " . current($arr) . "\n"; echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing each() : usage variations *** -- Current position: -- @@ -48,4 +48,4 @@ array(4) { -- New position: -- 1 => one -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/end_basic.phpt b/ext/standard/tests/array/end_basic.phpt index 56f037ab2f..d384f7d2ae 100644 --- a/ext/standard/tests/array/end_basic.phpt +++ b/ext/standard/tests/array/end_basic.phpt @@ -29,7 +29,7 @@ $array[2] = 'foo'; var_dump(end($array)); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing end() : basic functionality *** -- Initial Position: -- diff --git a/ext/standard/tests/array/end_variation1.phpt b/ext/standard/tests/array/end_variation1.phpt index 5ad896109f..8676a71da5 100644 --- a/ext/standard/tests/array/end_variation1.phpt +++ b/ext/standard/tests/array/end_variation1.phpt @@ -201,9 +201,7 @@ Warning: end() expects parameter 1 to be array, Unicode string given in %s on li NULL -- Iteration 22 -- - -Warning: end() expects parameter 1 to be array, object given in %s on line %d -NULL +unicode(12) "hello, world" -- Iteration 23 -- @@ -220,3 +218,4 @@ NULL Warning: end() expects parameter 1 to be array, resource given in %s on line %d NULL ===DONE=== + diff --git a/ext/standard/tests/array/end_variation2.phpt b/ext/standard/tests/array/end_variation2.phpt index ea9c336ac0..180f7cdfbd 100644 --- a/ext/standard/tests/array/end_variation2.phpt +++ b/ext/standard/tests/array/end_variation2.phpt @@ -25,7 +25,7 @@ echo "\n-- Pass a sub-array as \$array_arg --\n"; var_dump(end($array_arg[0])); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing end() : usage variations *** -- Pass a two-dimensional array as $array_arg -- diff --git a/ext/standard/tests/array/end_variation3.phpt b/ext/standard/tests/array/end_variation3.phpt index 0a83342949..1a28ec9901 100644 --- a/ext/standard/tests/array/end_variation3.phpt +++ b/ext/standard/tests/array/end_variation3.phpt @@ -29,7 +29,7 @@ echo "\$array2: "; var_dump(current($array2)); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing end() : usage variations *** -- Initial position of internal pointer -- diff --git a/ext/standard/tests/array/key_basic.phpt b/ext/standard/tests/array/key_basic.phpt index 0b4377ef52..f25e60d931 100644 --- a/ext/standard/tests/array/key_basic.phpt +++ b/ext/standard/tests/array/key_basic.phpt @@ -30,7 +30,7 @@ next($array); var_dump(key($array)); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing key() : basic functionality *** -- Initial Position: -- diff --git a/ext/standard/tests/array/key_variation1.phpt b/ext/standard/tests/array/key_variation1.phpt index 93d0ebc714..2dd87dd45a 100644 --- a/ext/standard/tests/array/key_variation1.phpt +++ b/ext/standard/tests/array/key_variation1.phpt @@ -201,9 +201,7 @@ Warning: key() expects parameter 1 to be array, Unicode string given in %s on li NULL -- Iteration 22 -- - -Warning: key() expects parameter 1 to be array, object given in %s on line %d -NULL +unicode(4) "var1" -- Iteration 23 -- @@ -220,3 +218,4 @@ NULL Warning: key() expects parameter 1 to be array, resource given in %s on line %d NULL ===DONE=== + diff --git a/ext/standard/tests/array/key_variation2.phpt b/ext/standard/tests/array/key_variation2.phpt index 6a463b9fdf..3d3401d751 100644 --- a/ext/standard/tests/array/key_variation2.phpt +++ b/ext/standard/tests/array/key_variation2.phpt @@ -104,7 +104,7 @@ foreach($inputs as $key => $input) { }; ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing key() : usage variations *** -- Iteration 1 : int data -- diff --git a/ext/standard/tests/array/key_variation3.phpt b/ext/standard/tests/array/key_variation3.phpt index 916e99af38..a231917814 100644 --- a/ext/standard/tests/array/key_variation3.phpt +++ b/ext/standard/tests/array/key_variation3.phpt @@ -31,7 +31,7 @@ echo "\$array2: "; var_dump(key($array2)); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing key() : usage variations *** -- Initial position of internal pointer -- diff --git a/ext/standard/tests/array/key_variation4.phpt b/ext/standard/tests/array/key_variation4.phpt index 6698d6385a..147d55aa13 100644 --- a/ext/standard/tests/array/key_variation4.phpt +++ b/ext/standard/tests/array/key_variation4.phpt @@ -45,7 +45,7 @@ var_dump(key($multi_array[3][3][3])); var_dump(key($multi_array[3][3][3][1])); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing key() : usage variations *** -- Two Dimensional Array -- diff --git a/ext/standard/tests/array/natcasesort_basic.phpt b/ext/standard/tests/array/natcasesort_basic.phpt index 06dfb6c277..4a9c5b5f97 100644 --- a/ext/standard/tests/array/natcasesort_basic.phpt +++ b/ext/standard/tests/array/natcasesort_basic.phpt @@ -23,7 +23,7 @@ var_dump($array); echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing natcasesort() : basic functionality *** -- Before sorting: -- @@ -54,4 +54,4 @@ array(5) { [2]=> unicode(3) "b10" } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_error.phpt b/ext/standard/tests/array/natcasesort_error.phpt index 377a407d72..9ae8691e1e 100644 --- a/ext/standard/tests/array/natcasesort_error.phpt +++ b/ext/standard/tests/array/natcasesort_error.phpt @@ -37,4 +37,4 @@ NULL Warning: natcasesort() expects exactly 1 parameter, 2 given in %s on line %d NULL -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 6c4fbec53c..918e051e6b 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_variation10.phpt b/ext/standard/tests/array/natcasesort_variation10.phpt index 09f69eb93d..00db813804 100644 --- a/ext/standard/tests/array/natcasesort_variation10.phpt +++ b/ext/standard/tests/array/natcasesort_variation10.phpt @@ -28,7 +28,7 @@ echo key($array_arg) . " => " . current ($array_arg) . "\n"; echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing natcasesort() : usage variations *** -- Initial Position of Internal Pointer: -- diff --git a/ext/standard/tests/array/natcasesort_variation11.phpt b/ext/standard/tests/array/natcasesort_variation11.phpt index c25e6c42da..604c219935 100644 --- a/ext/standard/tests/array/natcasesort_variation11.phpt +++ b/ext/standard/tests/array/natcasesort_variation11.phpt @@ -112,7 +112,7 @@ foreach($inputs as $input) { echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing natcasesort() : usage variations *** -- Iteration 1 -- @@ -229,4 +229,4 @@ array(3) { [u"hello"]=> unicode(5) "world" } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation2.phpt b/ext/standard/tests/array/natcasesort_variation2.phpt index eb592997d4..764d8fa77e 100644 --- a/ext/standard/tests/array/natcasesort_variation2.phpt +++ b/ext/standard/tests/array/natcasesort_variation2.phpt @@ -224,4 +224,4 @@ array(1) { [0]=> resource(%d) of type (stream) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation3.phpt b/ext/standard/tests/array/natcasesort_variation3.phpt index 08db874917..77f83e1d09 100644 --- a/ext/standard/tests/array/natcasesort_variation3.phpt +++ b/ext/standard/tests/array/natcasesort_variation3.phpt @@ -42,7 +42,7 @@ foreach ($inputs as $array_arg) { echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing natcasesort() : usage variation *** -- Iteration 1 -- @@ -132,4 +132,4 @@ array(7) { [1]=> float(2147483648) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation4.phpt b/ext/standard/tests/array/natcasesort_variation4.phpt index 8c655bd0c3..b3bb8b5a15 100644 --- a/ext/standard/tests/array/natcasesort_variation4.phpt +++ b/ext/standard/tests/array/natcasesort_variation4.phpt @@ -28,7 +28,7 @@ foreach ($inputs as $array_arg) { echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing natcasesort() : usage variation *** bool(true) array(11) { @@ -84,3 +84,4 @@ array(12) { unicode(1) "X" } Done + diff --git a/ext/standard/tests/array/natcasesort_variation5.phpt b/ext/standard/tests/array/natcasesort_variation5.phpt index f2cbd17191..867d0b89e4 100644 --- a/ext/standard/tests/array/natcasesort_variation5.phpt +++ b/ext/standard/tests/array/natcasesort_variation5.phpt @@ -19,7 +19,7 @@ var_dump($unsorted_hex_array); echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing natcasesort() : usage variation *** bool(true) array(11) { @@ -46,4 +46,4 @@ array(11) { [1]=> int(4095) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation6.phpt b/ext/standard/tests/array/natcasesort_variation6.phpt index bbbefa799e..1d151d80d3 100644 --- a/ext/standard/tests/array/natcasesort_variation6.phpt +++ b/ext/standard/tests/array/natcasesort_variation6.phpt @@ -29,7 +29,7 @@ var_dump($array); echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing natcasesort() : usage variation *** -- Initial test -- @@ -53,4 +53,4 @@ array(3) { [2]=> &int(555) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation7.phpt b/ext/standard/tests/array/natcasesort_variation7.phpt index f4c70702de..e53e34ced1 100644 --- a/ext/standard/tests/array/natcasesort_variation7.phpt +++ b/ext/standard/tests/array/natcasesort_variation7.phpt @@ -22,7 +22,7 @@ var_dump($array); echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing natcasesort() : usage variations *** array(5) { [0]=> @@ -93,4 +93,4 @@ array(5) { [2]=> unicode(4) "zero" } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation8.phpt b/ext/standard/tests/array/natcasesort_variation8.phpt index b0f7cbba50..fbced4a229 100644 --- a/ext/standard/tests/array/natcasesort_variation8.phpt +++ b/ext/standard/tests/array/natcasesort_variation8.phpt @@ -20,7 +20,7 @@ var_dump($unsorted_oct_array); echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing natcasesort() : usage variation *** bool(true) array(9) { @@ -43,4 +43,4 @@ array(9) { [0]=> int(669) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/natcasesort_variation9.phpt b/ext/standard/tests/array/natcasesort_variation9.phpt index 156375941b..cdb02982f3 100644 --- a/ext/standard/tests/array/natcasesort_variation9.phpt +++ b/ext/standard/tests/array/natcasesort_variation9.phpt @@ -8,7 +8,7 @@ Test natcasesort() function : usage variations - mixed array */ /* - * Pass an array containing sub-arrays, ints, floats, strings, boolean, null + * Pass an array containing sub-arrays, ints, floats, Unicode strings, boolean, null * and escape characters to test how natcasesort() re-orders it */ @@ -107,4 +107,4 @@ array(22) { [11]=> unicode(4) "True" } -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/next_basic.phpt b/ext/standard/tests/array/next_basic.phpt index 358e396e5f..c0e7accf0d 100644 --- a/ext/standard/tests/array/next_basic.phpt +++ b/ext/standard/tests/array/next_basic.phpt @@ -24,7 +24,7 @@ echo key($array) . " => " . current($array) . "\n"; var_dump(next($array)); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing next() : basic functionality *** 0 => zero unicode(3) "one" diff --git a/ext/standard/tests/array/next_variation1.phpt b/ext/standard/tests/array/next_variation1.phpt index 959b3b6ee0..45ed548588 100644 --- a/ext/standard/tests/array/next_variation1.phpt +++ b/ext/standard/tests/array/next_variation1.phpt @@ -200,9 +200,7 @@ Warning: next() expects parameter 1 to be array, Unicode string given in %s on l NULL -- Iteration 22 -- - -Warning: next() expects parameter 1 to be array, object given in %s on line %d -NULL +bool(false) -- Iteration 23 -- @@ -219,3 +217,4 @@ NULL Warning: next() expects parameter 1 to be array, resource given in %s on line %d NULL ===DONE=== + diff --git a/ext/standard/tests/array/next_variation2.phpt b/ext/standard/tests/array/next_variation2.phpt index 1ecde7efce..e7505096d9 100644 --- a/ext/standard/tests/array/next_variation2.phpt +++ b/ext/standard/tests/array/next_variation2.phpt @@ -26,7 +26,7 @@ echo "\n-- Pass a sub-array as \$array_arg --\n"; var_dump(next($array_arg[0])); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing next() : usage variations *** -- Pass a two-dimensional array as $array_arg -- diff --git a/ext/standard/tests/array/prev_variation1.phpt b/ext/standard/tests/array/prev_variation1.phpt index 43b73e850b..837b2e16e6 100755 --- a/ext/standard/tests/array/prev_variation1.phpt +++ b/ext/standard/tests/array/prev_variation1.phpt @@ -200,9 +200,7 @@ Warning: prev() expects parameter 1 to be array, Unicode string given in %s on l NULL -- Iteration 22 -- - -Warning: prev() expects parameter 1 to be array, object given in %s on line %d -NULL +bool(false) -- Iteration 23 -- @@ -219,3 +217,4 @@ NULL Warning: prev() expects parameter 1 to be array, resource given in %s on line %d NULL ===DONE=== + diff --git a/ext/standard/tests/array/reset_basic.phpt b/ext/standard/tests/array/reset_basic.phpt index b18f6ff64b..e29bcb5e47 100644 --- a/ext/standard/tests/array/reset_basic.phpt +++ b/ext/standard/tests/array/reset_basic.phpt @@ -28,7 +28,7 @@ echo "\n-- Call to reset() --\n"; var_dump(reset($array)); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing reset() : basic functionality *** -- Initial Position: -- diff --git a/ext/standard/tests/array/reset_variation1.phpt b/ext/standard/tests/array/reset_variation1.phpt index 1637789eb8..4743ca6682 100644 --- a/ext/standard/tests/array/reset_variation1.phpt +++ b/ext/standard/tests/array/reset_variation1.phpt @@ -200,9 +200,7 @@ Warning: reset() expects parameter 1 to be array, Unicode string given in %s on NULL -- Iteration 22 -- - -Warning: reset() expects parameter 1 to be array, object given in %s on line %d -NULL +bool(false) -- Iteration 23 -- @@ -219,3 +217,4 @@ NULL Warning: reset() expects parameter 1 to be array, resource given in %s on line %d NULL ===DONE=== + diff --git a/ext/standard/tests/array/reset_variation2.phpt b/ext/standard/tests/array/reset_variation2.phpt index 713c88adde..43b7875a01 100644 --- a/ext/standard/tests/array/reset_variation2.phpt +++ b/ext/standard/tests/array/reset_variation2.phpt @@ -23,7 +23,7 @@ unset($array[0]); var_dump(reset($array)); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing reset() : usage variations *** -- Initial Position: -- diff --git a/ext/standard/tests/array/reset_variation3.phpt b/ext/standard/tests/array/reset_variation3.phpt index eaccecc7bc..31e9706dcd 100644 --- a/ext/standard/tests/array/reset_variation3.phpt +++ b/ext/standard/tests/array/reset_variation3.phpt @@ -39,7 +39,7 @@ echo "\$array2: "; var_dump(current($array2)); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing reset() : usage variations *** -- Initial position of internal pointer -- diff --git a/ext/standard/tests/array/rsort_basic.phpt b/ext/standard/tests/array/rsort_basic.phpt index 4fe4673f83..bd65c43ed3 100644 --- a/ext/standard/tests/array/rsort_basic.phpt +++ b/ext/standard/tests/array/rsort_basic.phpt @@ -19,12 +19,12 @@ $unsorted_strings = array( "l" => "lemon", "o" => "orange", "b" => "banana" ); // array with default keys containing unsorted numeric values $unsorted_numerics = array( 100, 33, 555, 22 ); -echo "\n-- Testing rsort() by supplying string array, 'flag' value is default --\n"; +echo "\n-- Testing rsort() by supplying string array, 'flag' value is defualt --\n"; $temp_array = $unsorted_strings; var_dump( rsort($temp_array) ); var_dump( $temp_array); -echo "\n-- Testing rsort() by supplying numeric array, 'flag' value is default --\n"; +echo "\n-- Testing rsort() by supplying numeric array, 'flag' value is defualt --\n"; $temp_array = $unsorted_numerics; var_dump( rsort($temp_array) ); var_dump( $temp_array); @@ -52,10 +52,10 @@ var_dump( $temp_array); echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing rsort() : basic functionality *** --- Testing rsort() by supplying string array, 'flag' value is default -- +-- Testing rsort() by supplying string array, 'flag' value is defualt -- bool(true) array(3) { [0]=> @@ -66,7 +66,7 @@ array(3) { unicode(6) "banana" } --- Testing rsort() by supplying numeric array, 'flag' value is default -- +-- Testing rsort() by supplying numeric array, 'flag' value is defualt -- bool(true) array(4) { [0]=> @@ -126,4 +126,4 @@ array(4) { [3]=> int(22) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_error.phpt b/ext/standard/tests/array/rsort_error.phpt index 47dbf4c0bf..6f6f2f9762 100644 --- a/ext/standard/tests/array/rsort_error.phpt +++ b/ext/standard/tests/array/rsort_error.phpt @@ -48,4 +48,4 @@ array(2) { [1]=> int(2) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_object1.phpt b/ext/standard/tests/array/rsort_object1.phpt index a4999c33ca..2db9fb7d4d 100644 --- a/ext/standard/tests/array/rsort_object1.phpt +++ b/ext/standard/tests/array/rsort_object1.phpt @@ -34,7 +34,7 @@ class for_string_rsort } // return string value - function __tostring() { + function __tounicode() { return (string)$this->value; } @@ -58,12 +58,12 @@ $unsorted_str_obj = array ( echo "\n-- Sort flag = default --\n"; -// testing rsort() function by supplying integer object array, flag value is default +// testing rsort() function by supplying integer object array, flag value is defualt $temp_array = $unsorted_int_obj; var_dump(rsort($temp_array) ); var_dump($temp_array); -// testing rsort() function by supplying string object array, flag value is default +// testing rsort() function by supplying string object array, flag value is defualt $temp_array = $unsorted_str_obj; var_dump(rsort($temp_array) ); var_dump($temp_array); @@ -240,4 +240,4 @@ array(8) { unicode(5) "Lemon" } } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_object2.phpt b/ext/standard/tests/array/rsort_object2.phpt index fc3683e0b3..8071545ecf 100644 --- a/ext/standard/tests/array/rsort_object2.phpt +++ b/ext/standard/tests/array/rsort_object2.phpt @@ -43,7 +43,7 @@ class for_string_rsort } // return string value - function __tostring() { + function __tounicode() { return (string)$this->value; } @@ -69,12 +69,12 @@ $unsorted_str_obj = array ( echo "\n-- Sort flag = default --\n"; -// testing rsort() function by supplying integer object array, flag value is default +// testing rsort() function by supplying integer object array, flag value is defualt $temp_array = $unsorted_int_obj; var_dump(rsort($temp_array) ); var_dump($temp_array); -// testing rsort() function by supplying string object array, flag value is default +// testing rsort() function by supplying string object array, flag value is defualt $temp_array = $unsorted_str_obj; var_dump(rsort($temp_array) ); var_dump($temp_array); @@ -255,4 +255,4 @@ array(4) { unicode(3) "ass" } } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation1.phpt b/ext/standard/tests/array/rsort_variation1.phpt index 0abfde64a7..05b56e8631 100644 --- a/ext/standard/tests/array/rsort_variation1.phpt +++ b/ext/standard/tests/array/rsort_variation1.phpt @@ -511,4 +511,4 @@ Flag = SORT_STRING: Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d bool(false) -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation10.phpt b/ext/standard/tests/array/rsort_variation10.phpt index 2e4a96adba..ccf886b070 100644 --- a/ext/standard/tests/array/rsort_variation10.phpt +++ b/ext/standard/tests/array/rsort_variation10.phpt @@ -34,7 +34,7 @@ var_dump($temp_array); echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing rsort() : variation *** -- Sort flag = default -- @@ -105,4 +105,4 @@ array(9) { [8]=> int(-229) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation11.phpt b/ext/standard/tests/array/rsort_variation11.phpt index 408c37bd6e..73daf1712d 100644 Binary files a/ext/standard/tests/array/rsort_variation11.phpt and b/ext/standard/tests/array/rsort_variation11.phpt differ diff --git a/ext/standard/tests/array/rsort_variation2.phpt b/ext/standard/tests/array/rsort_variation2.phpt index e546b3f619..bf99ee9d71 100644 --- a/ext/standard/tests/array/rsort_variation2.phpt +++ b/ext/standard/tests/array/rsort_variation2.phpt @@ -481,4 +481,4 @@ array(5) { [4]=> int(1) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation3.phpt b/ext/standard/tests/array/rsort_variation3.phpt index ef1fb1085c..f8c002a6f7 100644 --- a/ext/standard/tests/array/rsort_variation3.phpt +++ b/ext/standard/tests/array/rsort_variation3.phpt @@ -1,5 +1,9 @@ --TEST-- Test rsort() function : usage variations - numeric values +--SKIPIF-- + --FILE-- ---EXPECT-- +--EXPECTF-- *** Testing rsort() : variation *** -- Iteration 1 -- -- With default sort flag - +- With Defualt sort flag - bool(true) array(9) { [0]=> @@ -128,7 +132,7 @@ array(9) { } -- Iteration 2 -- -- With default sort flag - +- With Defualt sort flag - bool(true) array(7) { [0]=> @@ -184,7 +188,7 @@ array(7) { } -- Iteration 3 -- -- With default sort flag - +- With Defualt sort flag - bool(true) array(11) { [0]=> @@ -264,7 +268,7 @@ array(11) { } -- Iteration 4 -- -- With default sort flag - +- With Defualt sort flag - bool(true) array(7) { [0]=> @@ -318,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 1eac39eeff..5e64a4e895 100644 --- a/ext/standard/tests/array/rsort_variation4.phpt +++ b/ext/standard/tests/array/rsort_variation4.phpt @@ -23,7 +23,7 @@ $value3 = 555; // an array containing integer references $unsorted_numerics = array( &$value1 , &$value2, &$value3); -echo "\n-- 'flag' value is default --\n"; +echo "\n-- 'flag' value is defualt --\n"; $temp_array = $unsorted_numerics; var_dump( rsort($temp_array) ); var_dump( $temp_array); @@ -44,7 +44,7 @@ echo "Done"; Deprecated: Call-time pass-by-reference has been deprecated in %s on line %d *** Testing rsort() : variation *** --- 'flag' value is default -- +-- 'flag' value is defualt -- bool(true) array(3) { [0]=> @@ -76,4 +76,4 @@ array(3) { [2]=> &int(33) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation5.phpt b/ext/standard/tests/array/rsort_variation5.phpt index b74037fc8c..ebd45f4793 100644 --- a/ext/standard/tests/array/rsort_variation5.phpt +++ b/ext/standard/tests/array/rsort_variation5.phpt @@ -47,7 +47,7 @@ foreach ($various_arrays as $array) { echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing rsort() : variation *** -- Iteration 1 -- @@ -218,4 +218,4 @@ array(12) { [11]=> unicode(6) "BANANA" } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation6.phpt b/ext/standard/tests/array/rsort_variation6.phpt index 4c27bca1e7..559a1ebaf7 100644 --- a/ext/standard/tests/array/rsort_variation6.phpt +++ b/ext/standard/tests/array/rsort_variation6.phpt @@ -16,7 +16,7 @@ echo "*** Testing rsort() : variation ***\n"; // an array contains unsorted hexadecimal values $unsorted_hex_array = array(0x1AB, 0xFFF, 0xF, 0xFF, 0x2AA, 0xBB, 0x1ab, 0xff, -0xFF, 0, -0x2aa); -echo "\n-- 'flag' value is default --\n"; +echo "\n-- 'flag' value is defualt --\n"; $temp_array = $unsorted_hex_array; var_dump(rsort($temp_array) ); var_dump($temp_array); @@ -34,10 +34,10 @@ var_dump($temp_array); echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing rsort() : variation *** --- 'flag' value is default -- +-- 'flag' value is defualt -- bool(true) array(11) { [0]=> @@ -117,4 +117,4 @@ array(11) { [10]=> int(-682) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation7.phpt b/ext/standard/tests/array/rsort_variation7.phpt index 033eedcf9b..a996bf6db3 100644 --- a/ext/standard/tests/array/rsort_variation7.phpt +++ b/ext/standard/tests/array/rsort_variation7.phpt @@ -16,7 +16,7 @@ echo "*** Testing rsort() : variation ***\n"; // bool value array $bool_values = array (true, false, TRUE, FALSE); -echo "\n-- 'flag' value is default --\n"; +echo "\n-- 'flag' value is defualt --\n"; $temp_array = $bool_values; var_dump(rsort($temp_array) ); var_dump($temp_array); @@ -39,10 +39,10 @@ var_dump($temp_array); echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing rsort() : variation *** --- 'flag' value is default -- +-- 'flag' value is defualt -- bool(true) array(4) { [0]=> @@ -93,4 +93,4 @@ array(4) { [3]=> bool(false) } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation8.phpt b/ext/standard/tests/array/rsort_variation8.phpt index 923127d980..a4f94b5f0f 100644 --- a/ext/standard/tests/array/rsort_variation8.phpt +++ b/ext/standard/tests/array/rsort_variation8.phpt @@ -51,7 +51,7 @@ foreach ($various_arrays as $array) { echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing rsort() : variation *** -- Iteration 1 -- @@ -177,4 +177,4 @@ array(4) { array(0) { } } -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/array/rsort_variation9.phpt b/ext/standard/tests/array/rsort_variation9.phpt index a78c43758e..dafe3fa090 100644 --- a/ext/standard/tests/array/rsort_variation9.phpt +++ b/ext/standard/tests/array/rsort_variation9.phpt @@ -54,7 +54,7 @@ foreach ($various_arrays as $array) { echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing rsort() : variation *** -- Iteration 1 -- @@ -256,4 +256,4 @@ array(4) { [3]=> int(1) } -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..6f447e01c5 --- /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..4eeb87649a --- /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, Unicode string given in %suksort_variation1.php on line %d +NULL + +--empty string SQ-- + +Warning: uksort() expects parameter 1 to be array, Unicode string given in %suksort_variation1.php on line %d +NULL + +--string DQ-- + +Warning: uksort() expects parameter 1 to be array, Unicode string given in %suksort_variation1.php on line %d +NULL + +--string SQ-- + +Warning: uksort() expects parameter 1 to be array, Unicode string given in %suksort_variation1.php on line %d +NULL + +--mixed case string-- + +Warning: uksort() expects parameter 1 to be array, Unicode string given in %suksort_variation1.php on line %d +NULL + +--heredoc-- + +Warning: uksort() expects parameter 1 to be array, Unicode 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..daf2cae316 --- /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..fb22bf9b72 --- /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]=> + unicode(4) "This" + [1]=> + unicode(1) "a" + [2]=> + unicode(2) "is" + [3]=> + unicode(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..955a5614ee --- /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..ab604005a4 --- /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..a86bab331e --- /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) { + [u"int_value":u"SimpleClass1":private]=> + int(1) + } + [1]=> + object(SimpleClass1)#%d (1) { + [u"int_value":u"SimpleClass1":private]=> + int(10) + } + [2]=> + object(SimpleClass1)#%d (1) { + [u"int_value":u"SimpleClass1":private]=> + int(50) + } + [3]=> + object(SimpleClass1)#%d (1) { + [u"int_value":u"SimpleClass1":private]=> + int(100) + } +} +bool(true) +array(3) { + [0]=> + object(SimpleClass2)#%d (3) { + [u"int_value":u"SimpleClass2":private]=> + int(2) + [u"float_value":protected]=> + float(3.4) + [u"string_value"]=> + unicode(5) "mango" + } + [1]=> + object(SimpleClass2)#%d (3) { + [u"int_value":u"SimpleClass2":private]=> + int(5) + [u"float_value":protected]=> + float(2.5) + [u"string_value"]=> + unicode(6) "orange" + } + [2]=> + object(SimpleClass2)#%d (3) { + [u"int_value":u"SimpleClass2":private]=> + int(10) + [u"float_value":protected]=> + float(1.2) + [u"string_value"]=> + unicode(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..55afb20e80 --- /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) { + [u"child_value"]=> + int(15) + [u"pub_value"]=> + NULL + } + [1]=> + object(ChildClass)#%d (2) { + [u"child_value"]=> + int(20) + [u"pub_value"]=> + NULL + } + [2]=> + object(ChildClass)#%d (2) { + [u"child_value"]=> + int(500) + [u"pub_value"]=> + NULL + } + [3]=> + object(ChildClass)#%d (2) { + [u"child_value"]=> + int(700) + [u"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..af8fa2e4f8 --- /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, Unicode string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: usort() expects parameter 1 to be array, Unicode string given in %s on line %d +NULL + +-- Iteration 18 -- +bool(true) + +-- Iteration 19 -- + +Warning: usort() expects parameter 1 to be array, Unicode string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: usort() expects parameter 1 to be array, Unicode string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: usort() expects parameter 1 to be array, Unicode 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..7f8b93070d --- /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]=> + unicode(5) "Apple" + [1]=> + unicode(6) "Banana" + [2]=> + unicode(5) "Mango" + [3]=> + unicode(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..ef140e3f5d --- /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..daade0349e --- /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..bf076f656a --- /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..e191212dbd --- /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]=> + unicode(0) "" + [1]=> + unicode(1) " " + [2]=> + unicode(1) "'" + [3]=> + unicode(1) "0" + [4]=> + unicode(8) "123Hello" + [5]=> + unicode(4) "@#$%" + [6]=> + unicode(5) "HELLO" + [7]=> + unicode(5) "Hello" + [8]=> + unicode(2) "\t" + [9]=> + unicode(4) "test" +} + +-- Sorting Double Quoted String values -- +bool(true) +array(10) { + [0]=> + unicode(0) "" + [1]=> + unicode(1) " " + [2]=> + unicode(1) " " + [3]=> + unicode(1) """ + [4]=> + unicode(1) "0" + [5]=> + unicode(8) "123Hello" + [6]=> + unicode(4) "@#$%" + [7]=> + unicode(5) "HELLO" + [8]=> + unicode(5) "Hello" + [9]=> + unicode(4) "test" +} + +-- Sorting Heredoc String values -- +bool(true) +array(4) { + [0]=> + unicode(0) "" + [1]=> + unicode(7) "HEREDOC" + [2]=> + unicode(7) "Heredoc" + [3]=> + unicode(%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..f5a554c0f0 --- /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]=> + unicode(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]=> + unicode(5) "apple" + [1]=> + unicode(5) "Apple" + [2]=> + unicode(5) "APPLE" + [3]=> + unicode(5) "aPPle" + [4]=> + unicode(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..84775d7117 --- /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]=> + unicode(5) "Apple" + [1]=> + unicode(6) "Banana" + [2]=> + unicode(5) "Mango" + [3]=> + unicode(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..db924794bd --- /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]=> + unicode(5) "apple" + [1]=> + unicode(6) "Banana" + [2]=> + unicode(5) "Mango" + [3]=> + unicode(6) "orange" + [4]=> + unicode(9) "Pineapple" +} + +-- Testing usort() with built-in 'cmp_function': strcmp() -- +bool(true) +array(5) { + [0]=> + unicode(6) "Banana" + [1]=> + unicode(5) "Mango" + [2]=> + unicode(9) "Pineapple" + [3]=> + unicode(5) "apple" + [4]=> + unicode(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..d727cf0e53 --- /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===