--- /dev/null
+--TEST--
+Test array_count_values() function : Invalid parameters
+--FILE--
+<?php
+/* Prototype : proto array array_count_values(array input)
+ * Description: Return the value as key and the frequency of that value in input as value
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/*
+ * Test for handling of incorrect parameters.
+ */
+
+echo "*** Testing array_count_values() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_count_values() function with Zero arguments --\n";
+var_dump( array_count_values() );
+
+//Test array_count_values with one more than the expected number of arguments
+echo "\n-- Testing array_count_values() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$extra_arg = 10;
+var_dump( array_count_values($input, $extra_arg) );
+
+//Test array_count_values with integer arguments
+echo "\n-- Testing array_count_values() function integer arguments --\n";
+var_dump( array_count_values(1 ));
+
+echo "Done";
+?>
+--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
--- /dev/null
+--TEST--
+Test array_count_values() function : Test all normal paramter variations
+--FILE--
+<?php
+/* Prototype : proto array array_count_values(array input)
+ * Description: Return the value as key and the frequency of that value in input as value
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/*
+ * Test behaviour with paramter variations
+ */
+
+echo "*** Testing array_count_values() : parameter variations ***\n";
+
+class A {
+ static function hello() {
+ echo "Hello\n";
+ }
+}
+
+$ob = new A();
+
+$fp = fopen("array_count_file", "w+");
+
+$arrays = array ("bobk" => "bobv", "val", 6 => "val6", $fp, $ob);
+
+var_dump (@array_count_values ($arrays));
+echo "\n";
+
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_count_values() : parameter variations ***
+array(3) {
+ ["bobv"]=>
+ int(1)
+ ["val"]=>
+ int(1)
+ ["val6"]=>
+ int(1)
+}
+
+Done
\ No newline at end of file
--- /dev/null
+--TEST--
+Test array_diff_uassoc() function : usage variation -Passing classWithoutToString (handling fatal error) to callback
+--FILE--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+//Initialize array
+$array1 = array("a" => "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===
+
--- /dev/null
+--TEST--
+Test array_diff_ukey() function : usage variation - Passing class without string to callback (Handling fatal error)
+--SKIPIF--
+<?php
+$php_version = phpversion();
+if(stristr($php_version, "5.2" ) == FALSE){
+ die('skip Test is applicable only for PHP5.2');
+}
+?>
+--FILE--
+<?php
+/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments. User supplied function is used for comparing the keys. This function is like array_udiff() but works on the keys instead of the values. The associativity is preserved.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_ukey() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array1 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
+$array2 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
+$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
--- /dev/null
+--TEST--
+Test array_fill_keys() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto array array_fill_keys(array keys, mixed val)
+ * Description: Create an array using the elements of the first parameter as keys each initialized to val
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing array_fill_keys() : error conditions ***\n";
+
+$keys = array(1, 2);
+$val = 1;
+$extra_arg = 10;
+
+echo "\n-- Testing array_fill_keys() function with more than expected no. of arguments --\n";
+var_dump( array_fill_keys($keys, $val, $extra_arg) );
+
+echo "\n-- Testing array_fill_keys() function with less than expected no. of arguments --\n";
+var_dump( array_fill_keys($keys) );
+
+echo "\n-- Testing array_fill_keys() function with no argumets --\n";
+var_dump( array_fill_keys() );
+
+echo "Done";
+?>
+--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
--- /dev/null
+--TEST--
+Test array_fill_keys() function : variation of parameter
+--FILE--
+<?php
+/* Prototype : proto array array_fill_keys(array keys, mixed val)
+ * Description: Create an array using the elements of the first parameter as keys each initialized to val
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing array_fill_keys() : parameter variations ***\n";
+
+$nullVal = null;
+$simpleStr = "simple";
+$fp = fopen(__FILE__, "r");
+$emptyArr = array();
+$bool = false;
+$float = 2.4;
+
+class classA {
+ public function __toString() { return "Class A object"; }
+}
+$obj = new classA();
+
+
+echo "\n-- Testing array_fill_keys() function with empty arguments --\n";
+var_dump( array_fill_keys($emptyArr, $nullVal) );
+
+echo "\n-- Testing array_fill_keys() function with keyed array --\n";
+$keyedArray = array("two" => 2, "strk1" => "strv1", 4, $simpleStr);
+var_dump( array_fill_keys($keyedArray, $simpleStr) );
+
+echo "\n-- Testing array_fill_keys() function with mixed array --\n";
+$mixedArray = array($fp, $obj, $simpleStr, $emptyArr, 2, $bool, $float);
+var_dump( array_fill_keys($mixedArray, $simpleStr) );
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_fill_keys() : parameter variations ***
+
+-- Testing array_fill_keys() function with empty arguments --
+array(0) {
+}
+
+-- Testing array_fill_keys() function with keyed array --
+array(4) {
+ [2]=>
+ string(6) "simple"
+ ["strv1"]=>
+ string(6) "simple"
+ [4]=>
+ string(6) "simple"
+ ["simple"]=>
+ string(6) "simple"
+}
+
+-- Testing array_fill_keys() function with mixed array --
+
+Notice: Array to string conversion in %sarray_fill_keys_variation1.php on line %d
+array(7) {
+ ["Resource id #%d"]=>
+ string(6) "simple"
+ ["Class A object"]=>
+ string(6) "simple"
+ ["simple"]=>
+ string(6) "simple"
+ ["Array"]=>
+ string(6) "simple"
+ [2]=>
+ string(6) "simple"
+ [""]=>
+ string(6) "simple"
+ ["2.4"]=>
+ string(6) "simple"
+}
+Done
\ No newline at end of file
--- /dev/null
+--TEST--
+Test array_fill_keys() function : variation of parameter
+--FILE--
+<?php
+/* Prototype : proto array array_fill_keys(array keys, mixed val)
+ * Description: Create an array using the elements of the first parameter as keys each initialized to val
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/* Testing with reference types for the arguments */
+
+echo "*** Testing array_fill_keys() : parameter variations ***\n";
+
+$nullVal = null;
+$simpleStr = "simple";
+$refString = &$simpleStr;
+$fp = fopen(__FILE__, "r");
+$emptyArr = array();
+$bool = false;
+$float = 2.4;
+
+class classA {
+ public function __toString() { return "Class A object"; }
+}
+$obj = new classA();
+
+
+echo "\n-- Testing array_fill_keys() function with reference value --\n";
+$keyedArray = array("one", "two");
+var_dump(array_fill_keys($keyedArray, $refString));
+
+echo "\n-- Testing array_fill_keys() function with reference keys --\n";
+$refKeys = array("one", &$simpleStr);
+$res = array_fill_keys($refKeys, $simpleStr);
+var_dump($res);
+$simpleStr = "bob";
+var_dump($res);
+
+
+echo "\n-- Testing array_fill_keys() function with reference array input --\n";
+$newArray = array("one", "two");
+$refArray = &$newArray;
+var_dump(array_fill_keys($refArray, $simpleStr));
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_fill_keys() : parameter variations ***
+
+-- Testing array_fill_keys() function with reference value --
+array(2) {
+ ["one"]=>
+ string(6) "simple"
+ ["two"]=>
+ string(6) "simple"
+}
+
+-- Testing array_fill_keys() function with reference keys --
+array(2) {
+ ["one"]=>
+ string(6) "simple"
+ ["simple"]=>
+ string(6) "simple"
+}
+array(2) {
+ ["one"]=>
+ string(6) "simple"
+ ["simple"]=>
+ string(6) "simple"
+}
+
+-- Testing array_fill_keys() function with reference array input --
+array(2) {
+ ["one"]=>
+ string(3) "bob"
+ ["two"]=>
+ string(3) "bob"
+}
+Done
\ No newline at end of file
--- /dev/null
+--TEST--
+Test array_fill_keys() function : variation of parameter
+--FILE--
+<?php
+/* Prototype : proto array array_fill_keys(array keys, mixed val)
+ * Description: Create an array using the elements of the first parameter as keys each initialized to val
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/* Testing with unexpected argument types */
+
+echo "*** Testing array_fill_keys() : parameter variations ***\n";
+
+$simpleStr = "simple";
+$fp = fopen(__FILE__, "r");
+$bool = false;
+$float = 2.4;
+$array = array("one", "two");
+$nullVal = null;
+
+echo "\n-- Testing array_fill_keys() function with both wrong arguments --\n";
+var_dump( array_fill_keys($bool, $float) );
+
+echo "\n-- Testing array_fill_keys() function with unusual second arguments --\n";
+var_dump( array_fill_keys($array, $fp) );
+
+echo "\n-- Testing array_fill_keys() function with mixed array --\n";
+var_dump( array_fill_keys($nullVal, $simpleStr) );
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_fill_keys() : parameter variations ***
+
+-- Testing array_fill_keys() function with both wrong arguments --
+
+Warning: array_fill_keys() expects parameter 1 to be array, boolean given in %sarray_fill_keys_variation3.php on line %d
+NULL
+
+-- Testing array_fill_keys() function with unusual second arguments --
+array(2) {
+ ["one"]=>
+ resource(%d) of type (stream)
+ ["two"]=>
+ resource(%d) of type (stream)
+}
+
+-- Testing array_fill_keys() function with mixed array --
+
+Warning: array_fill_keys() expects parameter 1 to be array, null given in %sarray_fill_keys_variation3.php on line %d
+NULL
+Done
\ No newline at end of file
--- /dev/null
+--TEST--
+Test array_fill_keys() function : variation of parameter
+--FILE--
+<?php
+/* Prototype : proto array array_fill_keys(array keys, mixed val)
+ * Description: Create an array using the elements of the first parameter as keys each initialized to val
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/* Testing with unexpected argument types */
+
+echo "*** Testing array_fill_keys() : parameter variations ***\n";
+
+$fp = fopen(__FILE__, "r");
+$bool = false;
+$float = 2.4;
+$array = array("one");
+$nullVal = null;
+$unset_var = 10;
+unset ($unset_var);
+
+
+class classA {
+ public function __toString() { return "Class A object"; }
+}
+$obj = new classA();
+
+echo "\n-- Testing array_fill_keys() function with float --\n";
+var_dump( array_fill_keys($array, $float) );
+
+echo "\n-- Testing array_fill_keys() function with null --\n";
+var_dump( array_fill_keys($array, $nullVal) );
+
+echo "\n-- Testing array_fill_keys() function with object --\n";
+var_dump( array_fill_keys($array, $obj) );
+
+echo "\n-- Testing array_fill_keys() function with boolean --\n";
+var_dump( array_fill_keys($array, $bool) );
+
+echo "\n-- Testing array_fill_keys() function with resource --\n";
+var_dump( array_fill_keys($array, $fp) );
+
+echo "\n-- Testing array_fill_keys() function with unset var --\n";
+var_dump( array_fill_keys($array, $unset_var) );
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_fill_keys() : parameter variations ***
+
+-- Testing array_fill_keys() function with float --
+array(1) {
+ ["one"]=>
+ float(2.4)
+}
+
+-- Testing array_fill_keys() function with null --
+array(1) {
+ ["one"]=>
+ NULL
+}
+
+-- Testing array_fill_keys() function with object --
+array(1) {
+ ["one"]=>
+ object(classA)#%d (0) {
+ }
+}
+
+-- Testing array_fill_keys() function with boolean --
+array(1) {
+ ["one"]=>
+ bool(false)
+}
+
+-- Testing array_fill_keys() function with resource --
+array(1) {
+ ["one"]=>
+ resource(%d) of type (stream)
+}
+
+-- Testing array_fill_keys() function with unset var --
+
+Notice: Undefined variable: unset_var in %sarray_fill_keys_variation4.php on line %d
+array(1) {
+ ["one"]=>
+ NULL
+}
+Done
\ No newline at end of file
$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 = <<<EOT
Hello world
array("hello", $heredoc => "string"), // heredoc
// array with object, unset variable and resource variable
-/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+/*10*/ array(@$unset_var => "hello"),
// 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;
$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) {
}
$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 = <<<EOT
Hello world
"\v\fworld" => 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;
$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) {
}
);
// loop through each element of the array for arr1
-
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
var_dump( array_intersect_key($value, $array2) );
echo "*** Testing array_intersect_key() : usage variation ***\n";
// Initialise function arguments not being substituted (if any)
-$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
-$array3 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
+$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
+$array3 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
//get an unset variable
$unset_var = 10;
);
// 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) );
foreach($input_arrays as $key =>$value) {
echo "\n--$key--\n";
var_dump( array_intersect_key($input_array, $value) );
- var_dump( array_intersect_key($value, $input_array ) );
+ var_dump( array_intersect_key($value,$input_array ) );
}
?>
===DONE===
--- /dev/null
+--TEST--
+Test array_intersect_uassoc() function : usage variation - Passing class without string to callback (Handling fatal error)
+--SKIPIF--
+<?php
+$php_version = phpversion();
+if(stristr($php_version, "5.2" ) == FALSE){
+ die('skip Test is applicable only for PHP5.2');
+}
+?>
+--FILE--
+<?php
+/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments
+$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
+$array2 = array("a" => "green", "yellow", "red");
+$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===
--- /dev/null
+--TEST--
+Test array_intersect_ukey() function : usage variation - Passing class without string to callback (Handling fatal error)
+--SKIPIF--
+<?php
+$php_version = phpversion();
+if(stristr($php_version, "5.2" ) == FALSE){
+ die('skip Test is applicable only for PHP5.2');
+}
+?>
+--FILE--
+<?php
+/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
+
+//Initialise arguments
+$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
+$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
+$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
$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 = <<<EOT
Hello world
"\v\fworld" => 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")
);
$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) {
}
$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 = <<<EOT
Hello world
"\v\fworld" => 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")
);
$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) {
}
--- /dev/null
+--TEST--
+Test array_map() function : usage variations - callback pass semantics
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() with a pass-by-value callback forced to behave as a pass-by-reference function.
+ */
+
+$arr1 = array('original.0', 'original.1');
+$arr2 = array('original.0', 'original.1');
+
+function callback($a) {
+ $a = "changed";
+}
+
+array_map('callback', $arr1);
+var_dump($arr1);
+
+$ref =& $arr2[0];
+array_map("callback", $arr2);
+var_dump($arr2);
+?>
+--EXPECTF--
+array(2) {
+ [0]=>
+ string(10) "original.0"
+ [1]=>
+ string(10) "original.1"
+}
+array(2) {
+ [0]=>
+ &string(7) "changed"
+ [1]=>
+ string(10) "original.1"
+}
\ No newline at end of file
--- /dev/null
+--TEST--
+next - ensure warning is received when passing an indirect temporary.
+--FILE--
+<?php
+function f() {
+ return array(1, 2);
+}
+var_dump(next(f()));
+?>
+--EXPECTF--
+
+Strict Standards: Only variables should be passed by reference in %s on line %d
+int(2)
\ No newline at end of file
--- /dev/null
+--TEST--
+next - ensure we cannot pass a temporary
+--FILE--
+<?php
+function f() {
+ return array(1, 2);
+}
+var_dump(next(array(1, 2)));
+?>
+--EXPECTF--
+
+Fatal error: Only variables can be passed by reference in %s on line %d
\ No newline at end of file
// array with special chars as keys
/*6*/ array('##' => "key1", '&$r' => 'key2', '!' => "key3", '<>' =>'key4',
- "NULL" => 'key5', "\n" => 'newline as key',
+ "NULL" => 'key5',
"\t" => "tab as key", "'" => 'single quote as key',
'"' => 'double quote as key', "\0" => "null char as key")
);
string\([0-9]*\) "[#&!N <\n\t'"\0]*[U#$>]*[rL]*[L]*"
}
Done
-
--- /dev/null
+--TEST--
+Test array_reduce() function : error conditions
+--FILE--
+<?php
+/* Prototype : mixed array_reduce(array input, mixed callback [, int initial])
+ * Description: Iteratively reduce the array to a single value via the callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_reduce() : error conditions ***\n";
+
+
+//Test array_reduce with one more than the expected number of arguments
+echo "\n-- Testing array_reduce() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$callback = 1;
+$initial = 10;
+$extra_arg = 10;
+var_dump( array_reduce($input, $callback, $initial, $extra_arg) );
+
+// Testing array_reduce with one less than the expected number of arguments
+echo "\n-- Testing array_reduce() function with less than expected no. of arguments --\n";
+$input = array(1, 2);
+var_dump( array_reduce($input) );
+
+?>
+===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===
--- /dev/null
+--TEST--
+Test array_reduce() function : variation
+--FILE--
+<?php
+/* Prototype : mixed array_reduce(array input, mixed callback [, int initial])
+ * Description: Iteratively reduce the array to a single value via the callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_reduce() : variation ***\n";
+
+
+function oneArg($v) {
+ return $v;
+}
+
+function threeArgs($v, $w, $x) {
+ return $v + $w + $x;
+}
+
+$array = array(1);
+
+echo "\n--- Testing with a callback with too few parameters ---\n";
+var_dump(array_reduce($array, "oneArg", 2));
+
+echo "\n--- Testing with a callback with too many parameters ---\n";
+var_dump(array_reduce($array, "threeArgs", 2));
+
+?>
+===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
--- /dev/null
+--TEST--
+Test array_reduce() function : variation - invalid parameters
+--FILE--
+<?php
+/* Prototype : mixed array_reduce(array input, mixed callback [, int initial])
+ * Description: Iteratively reduce the array to a single value via the callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_reduce() : variation - invalid parameters ***\n";
+
+
+$array = array(1);
+
+var_dump(array_reduce($array, "bogusbogus"));
+
+var_dump(array_reduce("bogusarray", "max"));
+
+var_dump(array_reduce(new stdClass(), "max"));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_reduce() : variation - invalid parameters ***
+
+Warning: array_reduce() expects parameter 2 to be a valid callback, function 'bogusbogus' not found or invalid function name in %sarray_reduce_variation2.php on line %d
+NULL
+
+Warning: array_reduce() expects parameter 1 to be array, string given in %sarray_reduce_variation2.php on line %d
+NULL
+
+Warning: array_reduce() expects parameter 1 to be array, object given in %sarray_reduce_variation2.php on line %d
+NULL
+===DONE===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test array_reduce() function : variation - object callbacks
+--FILE--
+<?php
+/* Prototype : mixed array_reduce(array input, mixed callback [, int initial])
+ * Description: Iteratively reduce the array to a single value via the callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_reduce() : variation - object callbacks ***\n";
+
+class A {
+ static function adder($a, $b) {return $a + $b;}
+ public function adder2($a, $b) {return $a + $b;}
+}
+
+$array = array(1);
+
+echo "\n--- Static method callback ---\n";
+var_dump(array_reduce($array, array("A", "adder")));
+
+echo "\n--- Instance method callback ---\n";
+var_dump(array_reduce($array, array(new A(), "adder2")));
+
+?>
+===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
--TEST--
-Test array_slice() - Third parameter (NULL vs 0)
+Test array_slice() function : usage variations - Pass different data types as $input arg
--FILE--
<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
-var_dump(array_slice(range(1, 3), 0, NULL, 1));
-var_dump(array_slice(range(1, 3), 0, 0, 1));
-var_dump(array_slice(range(1, 3), 0, NULL));
-var_dump(array_slice(range(1, 3), 0, 0));
+/*
+ * Pass different arguments as $input argument to array_slice() to test behaviour
+ */
-var_dump(array_slice(range(1, 3), -1, 0));
-var_dump(array_slice(range(1, 3), -1, 0, 1));
-var_dump(array_slice(range(1, 3), -1, NULL));
-var_dump(array_slice(range(1, 3), -1, NULL, 1));
+echo "*** Testing array_slice() : usage variations ***\n";
+// Initialise function arguments not being substituted
+$offset = 2;
-$a = 'foo';
-var_dump(array_slice(range(1, 3), 0, $a));
-var_dump(array_slice(range(1, 3), 0, $a));
-var_dump($a);
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_slice()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_slice($input, $offset) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
?>
--EXPECTF--
-array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
-}
-array(0) {
-}
-array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
-}
-array(0) {
-}
-array(0) {
-}
-array(0) {
-}
-array(1) {
- [0]=>
- int(3)
-}
-array(1) {
- [2]=>
- int(3)
-}
-array(0) {
-}
+*** Testing array_slice() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
array(0) {
}
-string(3) "foo"
+
+-- Iteration 19 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_slice() expects parameter 1 to be array, object given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: array_slice() expects parameter 1 to be array, resource given in %s on line %d
+NULL
+Done
\ No newline at end of file
--- /dev/null
+--TEST--
+Test array_udiff_assoc() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_assoc() : error conditions ***\n";
+
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+$extra_arg = 10;
+include('compare_function.inc');
+$key_comp_func = 'compare_function';
+
+
+//Test array_udiff_assoc with one more than the expected number of arguments
+echo "\n-- Testing array_udiff_assoc() function with more than expected no. of arguments --\n";
+var_dump( array_udiff_assoc($arr1, $arr2, $key_comp_func, $extra_arg) );
+
+// Testing array_udiff_assoc with one less than the expected number of arguments
+echo "\n-- Testing array_udiff_assoc() function with less than expected no. of arguments --\n";
+var_dump( array_udiff_assoc($arr1, $arr2) );
+
+?>
+===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
--- /dev/null
+--TEST--
+Test array_udiff_assoc() function : variation
+--FILE--
+<?php
+/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_assoc() : variation - testing with multiple array arguments ***\n";
+
+include('compare_function.inc');
+$key_compare_function = 'compare_function';
+
+// Initialise all required variables
+$arr1 = array("one" => "one", "02" => "two", '3' => "three", "four", "0.5" => 5, 6.0 => 6, "seven" => "0x7");
+$arr2 = array("one" => "one", "02" => "two", '3' => "three");
+$arr3 = array("four", "0.5" => "five", 6 => 6, "seven" => 7);
+$arr4 = array("four", "0.5" => "five", 6 => 6, "seven" => 7);
+
+
+var_dump( array_udiff_assoc($arr1, $arr2, $arr3, $arr4, $key_compare_function) );
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_udiff_assoc() : variation - testing with multiple array arguments ***
+array(2) {
+ [4]=>
+ string(4) "four"
+ ["0.5"]=>
+ int(5)
+}
+===DONE===
--- /dev/null
+--TEST--
+Test array_udiff_assoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$key_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for 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===
--- /dev/null
+--TEST--
+Test array_udiff_assoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+
+include('compare_function.inc');
+$key_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for 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===
--- /dev/null
+--TEST--
+Test array_udiff_assoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // 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===
--- /dev/null
+--TEST--
+Test array_udiff_assoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$key_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for ...
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( array_udiff_assoc($arr1, $arr2, $value, $key_comp_func) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_udiff_assoc() : usage variation ***
+
+--int 0--
+
+Warning: array_udiff_assoc(): 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===
--- /dev/null
+--TEST--
+Test array_udiff_assoc() function : usage variation - incorrect comparison functions
+--FILE--
+<?php
+/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing array_udiff_assoc() : usage variation - differing comparison functions***\n";
+
+$arr1 = array(1);
+$arr2 = array(1,2);
+
+echo "\n-- comparison function with an incorrect return value --\n";
+function incorrect_return_value ($val1, $val2) {
+ return array(1);
+}
+var_dump(array_udiff_assoc($arr1, $arr2, 'incorrect_return_value'));
+
+echo "\n-- comparison function taking too many parameters --\n";
+function too_many_parameters ($val1, $val2, $val3) {
+ return 1;
+}
+var_dump(array_udiff_assoc($arr1, $arr2, 'too_many_parameters'));
+
+echo "\n-- comparison function taking too few parameters --\n";
+function too_few_parameters ($val1) {
+ return 1;
+}
+var_dump(array_udiff_assoc($arr1, $arr2, 'too_few_parameters'));
+
+
+?>
+===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===
--- /dev/null
+--TEST--
+Test array_udiff() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments. Elements are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff() : error conditions ***\n";
+
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+$extra_arg = 10;
+
+
+//Test array_udiff with one more than the expected number of arguments
+echo "\n-- Testing array_udiff() function with more than expected no. of arguments --\n";
+var_dump( array_udiff($arr1, $arr2, $data_comp_func, $extra_arg) );
+
+// Testing array_udiff with one less than the expected number of arguments
+echo "\n-- Testing array_udiff() function with less than expected no. of arguments --\n";
+var_dump( array_udiff($arr1, $arr2) );
+
+?>
+===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===
--- /dev/null
+--TEST--
+Test array_udiff_uassoc() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_uassoc() : error conditions ***\n";
+
+
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+$key_comp_func = 'compare_function';
+$extra_arg = 10;
+
+//Test array_udiff_uassoc with one more than the expected number of arguments
+echo "\n-- Testing array_udiff_uassoc() function with more than expected no. of arguments --\n";
+var_dump( array_udiff_uassoc($arr1, $arr2, $data_comp_func, $key_comp_func, $extra_arg) );
+
+// Testing array_udiff_uassoc with one less than the expected number of arguments
+echo "\n-- Testing array_udiff_uassoc() function with less than expected no. of arguments --\n";
+var_dump( array_udiff_uassoc($arr1, $arr2, $data_comp_func) );
+
+?>
+===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===
--- /dev/null
+--TEST--
+Test array_udiff_uassoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+$key_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for 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
--- /dev/null
+--TEST--
+Test array_udiff_uassoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+$key_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for 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===
--- /dev/null
+--TEST--
+Test array_udiff_uassoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$key_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // 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===
--- /dev/null
+--TEST--
+Test array_udiff_uassoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // 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===
--- /dev/null
+--TEST--
+Test array_udiff_uassoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+$key_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for ...
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( array_udiff_uassoc($arr1, $arr2, $value, $data_comp_func, $key_comp_func) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_udiff_uassoc() : usage variation ***
+
+--int 0--
+
+Warning: array_udiff_uassoc(): 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===
--- /dev/null
+--TEST--
+Test array_udiff_uassoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_uassoc() : usage variation - differing comparison functions***\n";
+
+$arr1 = array(1);
+$arr2 = array(1);
+
+echo "\n-- comparison function with an incorrect return value --\n";
+function incorrect_return_value ($val1, $val2) {
+ return array(1);
+}
+var_dump(array_udiff_uassoc($arr1, $arr2, 'incorrect_return_value', 'incorrect_return_value'));
+
+echo "\n-- comparison function taking too many parameters --\n";
+function too_many_parameters ($val1, $val2, $val3) {
+ return 1;
+}
+var_dump(array_udiff_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters'));
+
+echo "\n-- comparison function taking too few parameters --\n";
+function too_few_parameters ($val1) {
+ return 1;
+}
+var_dump(array_udiff_uassoc($arr1, $arr2, 'too_few_parameters', 'too_few_parameters'));
+
+?>
+===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===
--- /dev/null
+--TEST--
+Test array_udiff() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments. Elements are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for 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
--- /dev/null
+--TEST--
+Test array_udiff() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments. Elements are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for 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===
--- /dev/null
+--TEST--
+Test array_udiff() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments. Elements are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // 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===
--- /dev/null
+--TEST--
+Test array_udiff() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments. Elements are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for ...
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( array_udiff($arr1, $arr2, $value, $data_comp_func) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_udiff() : usage variation ***
+
+--int 0--
+
+Warning: array_udiff(): 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===
--- /dev/null
+--TEST--
+Test array_udiff() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments. Elements are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1);
+$arr2 = array(1);
+
+echo "\n-- comparison function with an incorrect return value --\n";
+function incorrect_return_value ($val1, $val2) {
+ return array(1);
+}
+var_dump(array_udiff($arr1, $arr2, 'incorrect_return_value'));
+
+echo "\n-- comparison function taking too many parameters --\n";
+function too_many_parameters ($val1, $val2, $val3) {
+ return 0;
+}
+var_dump(array_udiff($arr1, $arr2, 'too_many_parameters'));
+
+echo "\n-- comparison function taking too few parameters --\n";
+function too_few_parameters ($val1) {
+ return 0;
+}
+var_dump(array_udiff($arr1, $arr2, 'too_few_parameters'));
+
+?>
+===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===
--- /dev/null
+--TEST--
+Test array_uintersect_assoc() function : basic functionality - testing with multiple array arguments
+--FILE--
+<?php
+/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: U
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_assoc() : basic functionality - testing with multiple array arguments ***\n";
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+// Initialise all required variables
+$arr1 = array("one" => "one", "02" => "two", '3' => "three", "four", "0.5" => 5, 0.6 => 6, "0x7" => "seven");
+$arr2 = array("one" => "one", "02" => "two", '3' => "three");
+$arr3 = array("one" => "one", '3' => "three", "0.5" => 5);
+$arr4 = array("one" => "one", '3' => "three", "0.5" => 5);
+
+
+var_dump( array_uintersect_assoc($arr1, $arr2, $arr3, $arr4, $data_compare_function) );
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_uintersect_assoc() : basic functionality - testing with multiple array arguments ***
+array(2) {
+ ["one"]=>
+ string(3) "one"
+ [3]=>
+ string(5) "three"
+}
+===DONE===
--- /dev/null
+--TEST--
+Test array_uintersect_assoc() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: U
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_assoc() : error conditions ***\n";
+
+//Test array_uintersect_assoc with one more than the expected number of arguments
+echo "\n-- Testing array_uintersect_assoc() function with more than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+$extra_arg = 10;
+var_dump( array_uintersect_assoc($arr1, $arr2, $data_compare_function, $extra_arg) );
+
+// Testing array_uintersect_assoc with one less than the expected number of arguments
+echo "\n-- Testing array_uintersect_assoc() function with less than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+var_dump( array_uintersect_assoc($arr1, $arr2) );
+
+?>
+===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===
--- /dev/null
+--TEST--
+Test array_uintersect_assoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: U
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for 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===
--- /dev/null
+--TEST--
+Test array_uintersect_assoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: U
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for 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===
--- /dev/null
+--TEST--
+Test array_uintersect_assoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: U
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // 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===
--- /dev/null
+--TEST--
+Test array_uintersect_assoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: U
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for ...
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( array_uintersect_assoc($arr1, $arr2, $value, $data_compare_function ) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_uintersect_assoc() : usage variation ***
+
+--int 0--
+
+Warning: array_uintersect_assoc(): 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
--- /dev/null
+--TEST--
+Test array_uintersect_assoc() function : usage variation - differing comparison functions
+--FILE--
+<?php
+/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Data is compared by using an user-supplied callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_assoc() : usage variation - differing comparison functions***\n";
+
+$arr1 = array(1);
+$arr2 = array(1,2);
+
+echo "\n-- comparison function with an incorrect return value --\n";
+function incorrect_return_value ($val1, $val2) {
+ return array(1);
+}
+var_dump(array_uintersect_assoc($arr1, $arr2, 'incorrect_return_value'));
+
+echo "\n-- comparison function taking too many parameters --\n";
+function too_many_parameters ($val1, $val2, $val3) {
+ return 1;
+}
+var_dump(array_uintersect_assoc($arr1, $arr2, 'too_many_parameters'));
+
+echo "\n-- comparison function taking too few parameters --\n";
+function too_few_parameters ($val1) {
+ return 1;
+}
+var_dump(array_uintersect_assoc($arr1, $arr2, 'too_few_parameters'));
+
+?>
+
+===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===
--- /dev/null
+--TEST--
+Test array_uintersect() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Data is compared by using an user-supplied callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect() : error conditions ***\n";
+
+
+//Test array_uintersect with one more than the expected number of arguments
+echo "\n-- Testing array_uintersect() function with more than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+$extra_arg = 10;
+var_dump( array_uintersect($arr1, $arr2, $data_compare_function, $extra_arg) );
+
+// Testing array_uintersect with one less than the expected number of arguments
+echo "\n-- Testing array_uintersect() function with less than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+var_dump( array_uintersect($arr1, $arr2) );
+
+?>
+===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===
--- /dev/null
+--TEST--
+Test array_uintersect_uassoc() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_uassoc() : error conditions ***\n";
+
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_func = 'compare_function';
+$key_compare_func = 'compare_function';
+
+$extra_arg = 10;
+
+
+//Test array_uintersect_uassoc with one more than the expected number of arguments
+echo "\n-- Testing array_uintersect_uassoc() function with more than expected no. of arguments --\n";
+var_dump( array_uintersect_uassoc($arr1, $arr2, $data_compare_func, $key_compare_func, $extra_arg) );
+
+// Testing array_uintersect_uassoc with one less than the expected number of arguments
+echo "\n-- Testing array_uintersect_uassoc() function with less than expected no. of arguments --\n";
+var_dump( array_uintersect_uassoc($arr1, $arr2, $data_compare_func) );
+
+?>
+===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===
--- /dev/null
+--TEST--
+Test array_uintersect_uassoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_func = 'compare_function';
+$key_compare_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for 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===
--- /dev/null
+--TEST--
+Test array_uintersect_uassoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_func = 'compare_function';
+$key_compare_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for 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===
--- /dev/null
+--TEST--
+Test array_uintersect_uassoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$key_compare_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // 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===
--- /dev/null
+--TEST--
+Test array_uintersect_uassoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // 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===
--- /dev/null
+--TEST--
+Test array_uintersect_uassoc() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_func = 'compare_function';
+$key_compare_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for ...
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( array_uintersect_uassoc($arr1, $arr2, $value, $data_compare_func, $key_compare_func) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_uintersect_uassoc() : usage variation ***
+
+--int 0--
+
+Warning: array_uintersect_uassoc(): 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===
--- /dev/null
+--TEST--
+Test array_uintersect_uassoc() function : usage variation - incorrect callbacks
+--FILE--
+<?php
+/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_uassoc() : usage variation - incorrect callbacks ***\n";
+
+$arr1 = array(1);
+$arr2 = array(1,2);
+
+echo "\n-- comparison function with an incorrect return value --\n";
+function incorrect_return_value ($val1, $val2) {
+ return array(1);
+}
+var_dump(array_uintersect_uassoc($arr1, $arr2, 'incorrect_return_value', 'incorrect_return_value'));
+
+echo "\n-- comparison function taking too many parameters --\n";
+function too_many_parameters ($val1, $val2, $val3) {
+ return 1;
+}
+var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters'));
+
+echo "\n-- comparison function taking too few parameters --\n";
+function too_few_parameters ($val1) {
+ return 1;
+}
+var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_few_parameters', 'too_few_parameters'));
+
+?>
+===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===
--- /dev/null
+--TEST--
+Test array_uintersect() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Data is compared by using an user-supplied callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for 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===
--- /dev/null
+--TEST--
+Test array_uintersect() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Data is compared by using an user-supplied callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for 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===
--- /dev/null
+--TEST--
+Test array_uintersect() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Data is compared by using an user-supplied callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // 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===
--- /dev/null
+--TEST--
+Test array_uintersect() function : usage variation
+--FILE--
+<?php
+/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Data is compared by using an user-supplied callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for ...
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( array_uintersect($arr1, $arr2, $value, $data_compare_function) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_uintersect() : usage variation ***
+
+--int 0--
+
+Warning: array_uintersect(): 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===
--- /dev/null
+--TEST--
+Test array_uintersect() function : usage variation - differing comparison functions
+--FILE--
+<?php
+/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Data is compared by using an user-supplied callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect() : usage variation - differing comparison functions***\n";
+
+$arr1 = array(1);
+$arr2 = array(1,2);
+
+echo "\n-- comparison function with an incorrect return value --\n";
+function incorrect_return_value ($val1, $val2) {
+ return array(1);
+}
+var_dump(array_uintersect($arr1, $arr2, 'incorrect_return_value'));
+
+echo "\n-- comparison function taking too many parameters --\n";
+function too_many_parameters ($val1, $val2, $val3) {
+ return 1;
+}
+var_dump(array_uintersect($arr1, $arr2, 'too_many_parameters'));
+
+echo "\n-- comparison function taking too few parameters --\n";
+function too_few_parameters ($val1) {
+ return 1;
+}
+var_dump(array_uintersect($arr1, $arr2, 'too_few_parameters'));
+
+?>
+
+===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===
-- 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
--- /dev/null
+--TEST--
+Test array_values() function : error conditions - Pass incorrect number of functions
+--FILE--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to array_values to test behaviour
+ */
+
+echo "*** Testing array_values() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_values() function with Zero arguments --\n";
+var_dump( array_values() );
+
+//Test array_values with one more than the expected number of arguments
+echo "\n-- Testing array_values() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$extra_arg = 10;
+var_dump( array_values($input, $extra_arg) );
+
+echo "Done";
+?>
+
+--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
+
--- /dev/null
+--TEST--
+Test array_values() function : usage variations - Internal order check
+--FILE--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Check that array_values is re-assigning keys according to the internal order of the array,
+ * and is not dependant on the \$input argument's keys
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+// populate array with 'default' keys in reverse order
+$input = array(3 => 'three', 2 => 'two', 1 => 'one', 0 => 'zero');
+
+echo "\n-- \$input argument: --\n";
+var_dump($input);
+
+echo "\n-- Result of array_values() --\n";
+var_dump(array_values($input));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : usage variations ***
+
+-- $input argument: --
+array(4) {
+ [3]=>
+ string(5) "three"
+ [2]=>
+ string(3) "two"
+ [1]=>
+ string(3) "one"
+ [0]=>
+ string(4) "zero"
+}
+
+-- Result of array_values() --
+array(4) {
+ [0]=>
+ string(5) "three"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(3) "one"
+ [3]=>
+ string(4) "zero"
+}
+Done
\ No newline at end of file
--- /dev/null
+--TEST--
+Test arsort() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing arsort() by providing integer/string arrays to check the basic functionality
+ * with following flag values.
+ * flag value as default
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+ * SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing arsort() : basic functionality ***\n";
+
+// an array containing unsorted string values with indices
+$unsorted_strings = array( "l" => "lemon", "o" => "orange", "b" => "banana" );
+// an array containing unsorted numeric values with indices
+$unsorted_numerics = array( 1 => 100, 2 => 33, 3 => 555, 4 => 22 );
+
+echo "\n-- Testing arsort() by supplying string array, 'flag' value is default --\n";
+$temp_array = $unsorted_strings;
+var_dump( arsort($temp_array) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing arsort() by supplying numeric array, 'flag' value is default --\n";
+$temp_array = $unsorted_numerics;
+var_dump( arsort($temp_array) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing arsort() by supplying string array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $unsorted_strings;
+var_dump( arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing arsort() by supplying numeric array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $unsorted_numerics;
+var_dump( arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing arsort() by supplying string array, 'flag' = SORT_STRING --\n";
+$temp_array = $unsorted_strings;
+var_dump( arsort($temp_array, SORT_STRING) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing arsort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n";
+$temp_array = $unsorted_numerics;
+var_dump( arsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : basic functionality ***
+
+-- Testing arsort() by supplying string array, 'flag' value is default --
+bool(true)
+array(3) {
+ ["o"]=>
+ string(6) "orange"
+ ["l"]=>
+ string(5) "lemon"
+ ["b"]=>
+ string(6) "banana"
+}
+
+-- Testing arsort() by supplying numeric array, 'flag' value is default --
+bool(true)
+array(4) {
+ [3]=>
+ int(555)
+ [1]=>
+ int(100)
+ [2]=>
+ int(33)
+ [4]=>
+ int(22)
+}
+
+-- Testing arsort() by supplying string array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ ["o"]=>
+ string(6) "orange"
+ ["l"]=>
+ string(5) "lemon"
+ ["b"]=>
+ string(6) "banana"
+}
+
+-- Testing arsort() by supplying numeric array, 'flag' = SORT_REGULAR --
+bool(true)
+array(4) {
+ [3]=>
+ int(555)
+ [1]=>
+ int(100)
+ [2]=>
+ int(33)
+ [4]=>
+ int(22)
+}
+
+-- Testing arsort() by supplying string array, 'flag' = SORT_STRING --
+bool(true)
+array(3) {
+ ["o"]=>
+ string(6) "orange"
+ ["l"]=>
+ string(5) "lemon"
+ ["b"]=>
+ string(6) "banana"
+}
+
+-- Testing arsort() by supplying numeric array, 'flag' = SORT_NUMERIC --
+bool(true)
+array(4) {
+ [3]=>
+ int(555)
+ [1]=>
+ int(100)
+ [2]=>
+ int(33)
+ [4]=>
+ int(22)
+}
+Done
\ No newline at end of file
--- /dev/null
+--TEST--
+Test arsort() function : object functionality - sort objects
+--FILE--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() by providing integer/string object arrays with following flag values
+ * 1. Defualt flag value
+ * 2. SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing arsort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_arsort
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+}
+
+// class declaration for string objects
+class for_string_arsort
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+ // return string value
+ function __tostring() {
+ return (string)$this->value;
+ }
+
+}
+
+// array of integer objects
+$unsorted_int_obj = array (
+ 1 => new for_integer_arsort(11), 2 => new for_integer_asort(66),
+ 3 => new for_integer_arsort(23), 4 => new for_integer_asort(-5),
+ 5 => new for_integer_arsort(0.001), 6 => new for_integer_asort(0)
+);
+
+// array of string objects
+$unsorted_str_obj = array (
+ "a" => new for_string_arsort("axx"), "b" => new for_string_asort("t"),
+ "c" => new for_string_arsort("w"), "d" => new for_string_asort("py"),
+ "e" => new for_string_arsort("apple"), "f" => new for_string_asort("Orange"),
+ "g" => new for_string_arsort("Lemon"), "h" => new for_string_asort("aPPle")
+);
+
+
+echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is defualt --\n";
+
+// testing arsort() function by supplying integer object array, flag value is defualt
+$temp_array = $unsorted_int_obj;
+var_dump(arsort($temp_array) );
+var_dump($temp_array);
+
+// testing arsort() function by supplying string object array, flag value is defualt
+$temp_array = $unsorted_str_obj;
+var_dump(arsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n";
+// testing arsort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(arsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing arsort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(arsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : object functionality ***
+
+Fatal error: Class 'for_integer_asort' not found in %sarsort_object1.php on line %d
\ No newline at end of file
--- /dev/null
+--TEST--
+Test arsort() function : object functionality - sorting objects with diff. accessibility of member vars
+--FILE--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() by providing integer/string object arrays with following flag values
+ * 1. Defualt flag value
+ 2. SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing arsort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_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;
+ }
+
+}
+
+// class declaration for string objects
+class for_string_arsort
+{
+ public $public_class_value;
+ private $private_class_value;
+ protected $protected_class_value;
+ // initializing object member value
+ function __construct($value1, $value2,$value3){
+ $this->public_class_value = $value1;
+ $this->private_class_value = $value2;
+ $this->protected_class_value = $value3;
+ }
+
+ // return string value
+ function __tostring() {
+ return (string)$this->value;
+ }
+}
+
+// array of integer objects
+$unsorted_int_obj = array (
+ 1 => new for_integer_arsort(11, 33,2), 2 => new for_integer_asort(44, 66,3),
+ 3 => new for_integer_arsort(23, 32,6), 4 => new for_integer_asort(-88, -5,-4),
+);
+
+// array of string objects
+$unsorted_str_obj = array (
+ "a" => new for_string_arsort("axx","AXX","d"), "b" => new for_string_asort("T", "t","q"),
+ "c" => new for_string_arsort("w", "W","c"), "d" => new for_string_asort("PY", "py","s"),
+);
+
+
+echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is default --\n";
+
+// testing arsort() function by supplying integer object array, flag value is default
+$temp_array = $unsorted_int_obj;
+var_dump(arsort($temp_array) );
+var_dump($temp_array);
+
+// testing arsort() function by supplying string object array, flag value is default
+$temp_array = $unsorted_str_obj;
+var_dump(arsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n";
+// testing arsort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(arsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing arsort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(arsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : object functionality ***
+
+Fatal error: Class 'for_integer_asort' not found in %sarsort_object2.php on line %d
\ No newline at end of file
--TEST--
Test arsort() function : usage variations - sort integer/float values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
--FILE--
<?php
/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing arsort() : usage variations ***
-- Testing arsort() by supplying various integer/float arrays --
bool(true)
array(7) {
[2]=>
- %s(2147483648)
+ float(2147483648)
[1]=>
int(2147483647)
[6]=>
[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]=>
[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]=>
[3]=>
int(-2147483647)
[4]=>
- %s(-2147483648)
+ float(-2147483648)
[7]=>
- %s(-2147483649)
+ float(-2147483649)
}
Done
\ No newline at end of file
--- /dev/null
+--TEST--
+Bug #44181 (extract EXTR_OVERWRITE|EXTR_REFS can fail to create references)
+--FILE--
+<?php
+$a = array('foo' => 'original.foo');
+
+$foo = 'test';
+$ref = &$a;
+
+extract($a, EXTR_OVERWRITE|EXTR_REFS);
+$foo = 'changed.foo';
+
+var_dump($a['foo']);
+echo "Done\n";
+?>
+--EXPECTF--
+string(%d) "changed.foo"
+Done
+
--- /dev/null
+--TEST--
+Bug #44182 (extract EXTR_REFS can fail to split copy-on-write references)
+--FILE--
+<?php
+$a = array('foo' => 'original.foo');
+
+$nonref = $a['foo'];
+$ref = &$a;
+
+extract($a, EXTR_REFS);
+$a['foo'] = 'changed.foo';
+
+var_dump($nonref);
+echo "Done\n";
+?>
+--EXPECTF--
+string(%d) "original.foo"
+Done
+
--- /dev/null
+--TEST--
+Test compact() function: ensure compact() doesn't pick up variables declared outside of current scope.
+--FILE--
+<?php
+/* Prototype : proto array compact(mixed var_names [, mixed ...])
+* Description: Creates a hash containing variables and their values
+* Source code: ext/standard/array.c
+* Alias to functions:
+*/
+echo "*** Testing compact() : usage variations - variables outside of current scope ***\n";
+
+$a = 'main.a';
+$b = 'main.b';
+
+function f() {
+ $b = 'f.b';
+ $c = 'f.c';
+ var_dump(compact('a','b','c'));
+ var_dump(compact(array('a','b','c')));
+}
+
+f();
+
+?>
+==Done==
+--EXPECTF--
+*** Testing compact() : usage variations - variables outside of current scope ***
+array(2) {
+ ["b"]=>
+ string(3) "f.b"
+ ["c"]=>
+ string(3) "f.c"
+}
+array(2) {
+ ["b"]=>
+ string(3) "f.b"
+ ["c"]=>
+ string(3) "f.c"
+}
+==Done==
\ No newline at end of file
--- /dev/null
+<?php
+
+function compare_function($var1, $var2) {
+ if ($var1 == $var2) {
+ return 0;
+ } else if ($var1 < $var2) {
+ return -1;
+ } else {
+ return 1;
+ }
+}
+
+?>
\ No newline at end of file
Warning: each() expects exactly 1 parameter, 2 given in %s on line %d
NULL
-Done
\ No newline at end of file
+Done
+
--TEST--
Test each() function : usage variations - Referenced variables
---INI--
-allow_call_time_pass_reference=on
--FILE--
<?php
/* Prototype : array each(array $arr)
[2]=>
string(3) "two"
}
-Done
+Done
\ No newline at end of file
Warning: natcasesort() expects parameter 1 to be array, resource given in %s on line %d
NULL
Done
+
[1]=>
float(2147483648)
}
-Done
+Done
\ No newline at end of file
--- /dev/null
+--TEST--
+Test natsort(): basic functionality
+--FILE--
+<?php
+/*
+* proto bool natsort ( array &$array )
+* Function is implemented in ext/standard/array.c
+*/
+$array1 = $array2 = array("img12.png", "img10.png", "img2.png", "img1.png");
+sort($array1);
+echo "Standard sorting\n";
+print_r($array1);
+natsort($array2);
+echo "\nNatural order sorting\n";
+print_r($array2);
+?>
+--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
+)
+
[6]=>
float(-2147483649)
}
-Done
+Done
\ No newline at end of file
--TEST--
Test rsort() function : usage variations - referenced variables
---INI--
-allow_call_time_pass_reference=on
--FILE--
<?php
/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
[2]=>
&int(33)
}
-Done
+Done
\ No newline at end of file
--- /dev/null
+--TEST--
+Test uksort(): basic functionality
+--FILE--
+<?php
+/*
+* proto bool uksort ( array &$array, callback $cmp_function )
+* Function is implemented in ext/standard/array.c
+*/
+function cmp($a, $b) {
+ if ($a == $b) {
+ return 0;
+ }
+ return ($a < $b) ? -1 : 1;
+}
+$a = array(3, 2, 5, 6, 1);
+uasort($a, "cmp");
+foreach($a as $key => $value) {
+ echo "$key: $value\n";
+}
+?>
+--EXPECT--
+4: 1
+1: 2
+0: 3
+2: 5
+3: 6
\ No newline at end of file
--- /dev/null
+--TEST--
+Test uksort() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool uksort(array array_arg, string cmp_function)
+ * Description: Sort an array by keys using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing uksort() : error conditions ***\n";
+
+echo "\n-- Testing uksort() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$cmp_function = 'string_val';
+$extra_arg = 10;
+var_dump( uksort($array_arg, $cmp_function, $extra_arg) );
+
+echo "\n-- Testing uksort() function with less than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+var_dump( uksort($array_arg) );
+
+echo "\n-- Testing uksort() function with zero arguments --\n";
+var_dump( uksort() );
+
+?>
+===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===
--- /dev/null
+--TEST--
+Test uksort() function : usage variation
+--FILE--
+<?php
+/* Prototype : bool uksort(array array_arg, string cmp_function)
+ * Description: Sort an array by keys using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing uksort() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$cmp_function = 'string_val';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for array_arg
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( uksort($value, $cmp_function) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing uksort() : usage variation ***
+
+--int 0--
+
+Warning: uksort() expects parameter 1 to be array, integer given in %suksort_variation1.php on line %d
+NULL
+
+--int 1--
+
+Warning: uksort() expects parameter 1 to be array, integer given in %suksort_variation1.php on line %d
+NULL
+
+--int 12345--
+
+Warning: uksort() expects parameter 1 to be array, integer given in %suksort_variation1.php on line %d
+NULL
+
+--int -12345--
+
+Warning: uksort() expects parameter 1 to be array, integer given in %suksort_variation1.php on line %d
+NULL
+
+--float 10.5--
+
+Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d
+NULL
+
+--float -10.5--
+
+Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d
+NULL
+
+--float 12.3456789000e10--
+
+Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d
+NULL
+
+--float -12.3456789000e10--
+
+Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d
+NULL
+
+--float .5--
+
+Warning: uksort() expects parameter 1 to be array, double given in %suksort_variation1.php on line %d
+NULL
+
+--uppercase NULL--
+
+Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d
+NULL
+
+--lowercase null--
+
+Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d
+NULL
+
+--lowercase true--
+
+Warning: uksort() expects parameter 1 to be array, boolean given in %suksort_variation1.php on line %d
+NULL
+
+--lowercase false--
+
+Warning: uksort() expects parameter 1 to be array, boolean given in %suksort_variation1.php on line %d
+NULL
+
+--uppercase TRUE--
+
+Warning: uksort() expects parameter 1 to be array, boolean given in %suksort_variation1.php on line %d
+NULL
+
+--uppercase FALSE--
+
+Warning: uksort() expects parameter 1 to be array, boolean given in %suksort_variation1.php on line %d
+NULL
+
+--empty string DQ--
+
+Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d
+NULL
+
+--empty string SQ--
+
+Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d
+NULL
+
+--string DQ--
+
+Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d
+NULL
+
+--string SQ--
+
+Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d
+NULL
+
+--mixed case string--
+
+Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d
+NULL
+
+--heredoc--
+
+Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d
+NULL
+
+--instance of classWithToString--
+
+Warning: uksort() expects parameter 1 to be array, object given in %suksort_variation1.php on line %d
+NULL
+
+--instance of classWithoutToString--
+
+Warning: uksort() expects parameter 1 to be array, object given in %suksort_variation1.php on line %d
+NULL
+
+--undefined var--
+
+Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d
+NULL
+
+--unset var--
+
+Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d
+NULL
+===DONE===
--- /dev/null
+--TEST--
+Test uksort() function : usage variation
+--FILE--
+<?php
+/* Prototype : bool uksort(array array_arg, string cmp_function)
+ * Description: Sort an array by keys using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing uksort() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array_arg = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // 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===
--- /dev/null
+--TEST--
+Test usort() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of usort() with indexed and associative arrays
+ */
+
+echo "*** Testing usort() : basic functionality ***\n";
+
+function cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// Int array with default keys
+$int_values = array(1, 8, 9, 3, 2, 6, 7);
+
+echo "\n-- Numeric array with default keys --\n";
+var_dump( usort($int_values, 'cmp') );
+var_dump($int_values);
+
+// String array with default keys
+$string_values = array("This", "is", 'a', "test");
+
+echo "\n-- String array with default keys --\n";
+var_dump( usort($string_values, 'cmp') );
+var_dump($string_values);
+
+// Associative array with numeric keys
+$numeric_key_arg = array(1=> 1, 2 => 2, 3 => 7, 5 => 4, 4 => 9);
+
+echo "\n-- Associative array with numeric keys --\n";
+var_dump( usort($numeric_key_arg, 'cmp') );
+var_dump($numeric_key_arg);
+
+// Associative array with string keys
+$string_key_arg = array('one' => 4, 'two' => 2, 'three' => 1, 'four' => 10);
+
+echo "\n-- Associative array with string keys --\n";
+var_dump( usort($string_key_arg, 'cmp') );
+var_dump($string_key_arg);
+?>
+===DONE===
+--EXPECTF--
+*** Testing usort() : basic functionality ***
+
+-- Numeric array with default keys --
+bool(true)
+array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(6)
+ [4]=>
+ int(7)
+ [5]=>
+ int(8)
+ [6]=>
+ int(9)
+}
+
+-- String array with default keys --
+bool(true)
+array(4) {
+ [0]=>
+ string(4) "This"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(2) "is"
+ [3]=>
+ string(4) "test"
+}
+
+-- Associative array with numeric keys --
+bool(true)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(4)
+ [3]=>
+ int(7)
+ [4]=>
+ int(9)
+}
+
+-- Associative array with string keys --
+bool(true)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(4)
+ [3]=>
+ int(10)
+}
+===DONE===
--- /dev/null
+--TEST--
+Test usort() function : error conditions - Pass incorrect number of arguments
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to usort() to test behaviour
+ */
+
+echo "*** Testing usort() : error conditions ***\n";
+
+//Test usort with one more than the expected number of arguments
+echo "\n-- Testing usort() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$cmp_function = 'string_val';
+$extra_arg = 10;
+var_dump( usort($array_arg, $cmp_function, $extra_arg) );
+
+// Testing usort with one less than the expected number of arguments
+echo "\n-- Testing usort() function with less than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+var_dump( usort($array_arg) );
+?>
+===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
--- /dev/null
+--TEST--
+Test usort() function : error conditions - Pass unknown 'cmp_function'
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an unknown comparison function to usort() to test behaviour.
+ * Pass incorrect number of arguments and an unknown function to test which error
+ * is generated.
+ */
+
+echo "*** Testing usort() : error conditions ***\n";
+
+function cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $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
--- /dev/null
+--TEST--
+Test usort() function : object functionality - different number of properties
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array of objects which have a different number of properties
+ * to test behaviour of usort()
+ */
+
+echo "*** Testing usort() : object functionality ***\n";
+
+function simple_cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// comparison function for SimpleClass2 objects which has more than one member
+function multiple_cmp($value1, $value2)
+{
+ if($value1->getValue() == $value2->getValue())
+ return 0;
+ else if($value1->getValue() > $value2->getValue())
+ return 1;
+ else
+ return -1;
+}
+
+// Simple class with single property
+class SimpleClass1
+{
+ private $int_value;
+
+ public function __construct($value) {
+ $this->int_value = $value;
+ }
+}
+
+// Simple class with more than one property
+class SimpleClass2
+{
+ private $int_value;
+ protected $float_value;
+ public $string_value;
+ public function __construct($int, $float, $str) {
+ $this->int_value = $int;
+ $this->float_value = $float;
+ $this->string_value = $str;
+ }
+ public function getValue() {
+ return $this->int_value;
+ }
+}
+
+// array of SimpleClass objects with only one property
+$array_arg = array(
+0 => new SimpleClass1(10),
+1 => new SimpleClass1(1),
+2 => new SimpleClass1(100),
+3 => new SimpleClass1(50)
+);
+var_dump( usort($array_arg, 'simple_cmp') );
+var_dump($array_arg);
+
+// array of SimpleClass objects having more than one properties
+$array_arg = array(
+0 => new SimpleClass2(2, 3.4, "mango"),
+1 => new SimpleClass2(10, 1.2, "apple"),
+2 => new SimpleClass2(5, 2.5, "orange"),
+);
+var_dump( usort($array_arg, 'multiple_cmp') );
+var_dump($array_arg);
+?>
+===DONE===
+--EXPECTF--
+*** Testing usort() : object functionality ***
+bool(true)
+array(4) {
+ [0]=>
+ object(SimpleClass1)#%d (1) {
+ ["int_value":"SimpleClass1":private]=>
+ int(1)
+ }
+ [1]=>
+ object(SimpleClass1)#%d (1) {
+ ["int_value":"SimpleClass1":private]=>
+ int(10)
+ }
+ [2]=>
+ object(SimpleClass1)#%d (1) {
+ ["int_value":"SimpleClass1":private]=>
+ int(50)
+ }
+ [3]=>
+ object(SimpleClass1)#%d (1) {
+ ["int_value":"SimpleClass1":private]=>
+ int(100)
+ }
+}
+bool(true)
+array(3) {
+ [0]=>
+ object(SimpleClass2)#%d (3) {
+ ["int_value":"SimpleClass2":private]=>
+ int(2)
+ ["float_value":protected]=>
+ float(3.4)
+ ["string_value"]=>
+ string(5) "mango"
+ }
+ [1]=>
+ object(SimpleClass2)#%d (3) {
+ ["int_value":"SimpleClass2":private]=>
+ int(5)
+ ["float_value":protected]=>
+ float(2.5)
+ ["string_value"]=>
+ string(6) "orange"
+ }
+ [2]=>
+ object(SimpleClass2)#%d (3) {
+ ["int_value":"SimpleClass2":private]=>
+ int(10)
+ ["float_value":protected]=>
+ float(1.2)
+ ["string_value"]=>
+ string(5) "apple"
+ }
+}
+===DONE===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test usort() function : object functionality - Different types of classes
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array of objects which are either:
+ * 1. Empty
+ * 2. Static
+ * 2. Inherited
+ * to test behaviour of usort()
+ */
+
+echo "*** Testing usort() : object functionality ***\n";
+
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// Class without any member
+class EmptyClass
+{
+}
+
+// Class with static member
+class StaticClass
+{
+ public static $static_value;
+ public function __construct($value) {
+ StaticClass::$static_value = $value;
+ }
+}
+
+// Abstract class
+abstract class AbstractClass
+{
+ public $pub_value;
+ public abstract function abstractMethod();
+}
+
+// Child class extending abstract class
+class ChildClass extends AbstractClass
+{
+ public $child_value = 100;
+ public function abstractMethod() {
+ $pub_value = 5;
+ }
+ public function __construct($value) {
+ $this->child_value = $value;
+ }
+}
+
+// Testing uasort with StaticClass objects as elements of 'array_arg'
+echo "-- Testing usort() with StaticClass objects --\n";
+$array_arg = array(
+ 0 => new StaticClass(20),
+ 1 => new StaticClass(50),
+ 2 => new StaticClass(15),
+ 3 => new StaticClass(70),
+);
+var_dump( usort($array_arg, 'cmp_function') );
+var_dump($array_arg);
+
+// Testing uasort with EmptyClass objects as elements of 'array_arg'
+echo "-- Testing usort() with EmptyClass objects --\n";
+$array_arg = array(
+ 0 => new EmptyClass(),
+ 1 => new EmptyClass(),
+ 2 => new EmptyClass(),
+ 3 => new EmptyClass(),
+);
+var_dump( usort($array_arg, 'cmp_function') );
+var_dump($array_arg);
+
+// Testing uasort with ChildClass objects as elements of 'array_arg'
+echo "-- Testing usort() with ChildClass objects --\n";
+$array_arg = array(
+ 0 => new ChildClass(20),
+ 1 => new ChildClass(500),
+ 2 => new ChildClass(15),
+ 3 => new ChildClass(700),
+);
+var_dump( usort($array_arg, 'cmp_function') );
+var_dump($array_arg);
+?>
+===DONE===
+--EXPECTF--
+*** Testing usort() : object functionality ***
+-- Testing usort() with StaticClass objects --
+bool(true)
+array(4) {
+ [0]=>
+ object(StaticClass)#%d (0) {
+ }
+ [1]=>
+ object(StaticClass)#%d (0) {
+ }
+ [2]=>
+ object(StaticClass)#%d (0) {
+ }
+ [3]=>
+ object(StaticClass)#%d (0) {
+ }
+}
+-- Testing usort() with EmptyClass objects --
+bool(true)
+array(4) {
+ [0]=>
+ object(EmptyClass)#%d (0) {
+ }
+ [1]=>
+ object(EmptyClass)#%d (0) {
+ }
+ [2]=>
+ object(EmptyClass)#%d (0) {
+ }
+ [3]=>
+ object(EmptyClass)#%d (0) {
+ }
+}
+-- Testing usort() with ChildClass objects --
+bool(true)
+array(4) {
+ [0]=>
+ object(ChildClass)#%d (2) {
+ ["child_value"]=>
+ int(15)
+ ["pub_value"]=>
+ NULL
+ }
+ [1]=>
+ object(ChildClass)#%d (2) {
+ ["child_value"]=>
+ int(20)
+ ["pub_value"]=>
+ NULL
+ }
+ [2]=>
+ object(ChildClass)#%d (2) {
+ ["child_value"]=>
+ int(500)
+ ["pub_value"]=>
+ NULL
+ }
+ [3]=>
+ object(ChildClass)#%d (2) {
+ ["child_value"]=>
+ int(700)
+ ["pub_value"]=>
+ NULL
+ }
+}
+===DONE===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test usort() function : usage variations - Pass different data types as $array_arg arg
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg argument to usort() to test behaviour
+ */
+
+echo "*** Testing usort() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $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 = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of usort()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( usort($input, 'cmp_function') );
+ $iterator++;
+};
+
+//closing resource
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing usort() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: usort() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: usort() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: usort() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: usort() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: usort() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: usort() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: usort() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: usort() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: usort() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: usort() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: usort() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: usort() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: usort() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: usort() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: usort() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: usort() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: usort() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+bool(true)
+
+-- Iteration 19 --
+
+Warning: usort() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: usort() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: usort() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: usort() expects parameter 1 to be array, object given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: usort() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: usort() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: usort() expects parameter 1 to be array, resource given in %s on line %d
+NULL
+===DONE===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test usort() function : usage variations - duplicate keys and values
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array with duplicate keys and values to usort() to test behaviour
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+function cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// Array with duplicate string and integer keys and values
+$array_arg = array(0 => 2, "a" => 8, "d" => 9,
+ 3 => 3, 5 => 2, "o" => 6,
+ "z" => -99, 0 => 1, "z" => 3);
+
+echo "\n-- Array with duplicate keys --\n";
+var_dump( usort($array_arg, 'cmp') );
+var_dump($array_arg);
+
+// Array with default and assigned keys
+$array_arg = array(0 => "Banana", 1 => "Mango", "Orange", 2 => "Apple", "Pineapple");
+
+echo "\n-- Array with default/assigned keys --\n";
+var_dump( usort($array_arg, 'cmp') );
+var_dump($array_arg);
+?>
+===DONE===
+--EXPECTF--
+*** Testing usort() : usage variation ***
+
+-- Array with duplicate keys --
+bool(true)
+array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(3)
+ [4]=>
+ int(6)
+ [5]=>
+ int(8)
+ [6]=>
+ int(9)
+}
+
+-- Array with default/assigned keys --
+bool(true)
+array(4) {
+ [0]=>
+ string(5) "Apple"
+ [1]=>
+ string(6) "Banana"
+ [2]=>
+ string(5) "Mango"
+ [3]=>
+ string(9) "Pineapple"
+}
+===DONE===
--- /dev/null
+--TEST--
+Test usort() function : usage variations - Pass different data types as $cmp_function arg
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $cmp_function argument to usort() to test behaviour
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+// Class definition for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return 'object';
+ }
+}
+
+$array_arg = array(0 => 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
--- /dev/null
+--TEST--
+Test usort() function : usage variations - diff. array values
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array with different data types as keys to usort() to test how it is re-ordered
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return -1;
+ }
+ else {
+ return 1;
+ }
+}
+
+// different heredoc strings
+
+// single line heredoc string
+$simple_heredoc = <<<EOT2
+simple
+EOT2;
+
+// multiline heredoc string
+$multiline_heredoc = <<<EOT3
+multiline heredoc with 123
+and speci@! ch@r..\ncheck\talso
+EOT3;
+
+$array_arg = array(
+ // numeric keys
+ -2 => 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===
--- /dev/null
+--TEST--
+Test usort() function : usage variations - numeric data
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays of numeric data to usort() to test how it is re-ordered
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $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===
--- /dev/null
+--TEST--
+Test usort() function : usage variations - string data
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays of string data to usort() to test how it is re-ordered
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+// Different heredoc strings to be sorted
+$empty_heredoc =<<<EOT
+EOT;
+
+$simple_heredoc1 =<<<EOT
+Heredoc
+EOT;
+
+$simple_heredoc2 =<<<EOT
+HEREDOC
+EOT;
+
+$multiline_heredoc =<<<EOT
+heredoc string\twith!@# and 123
+Test this!!!
+EOT;
+
+// Single quoted strings
+$single_quoted_values = array(
+ 0 => ' ', 1 => 'test', 3 => 'Hello', 4 => 'HELLO',
+ 5 => '', 6 => '\t', 7 => '0', 8 => '123Hello',
+ 9 => '\'', 10 => '@#$%'
+);
+
+echo "\n-- Sorting Single Quoted String values --\n";
+var_dump( usort($single_quoted_values, 'cmp_function') );
+var_dump($single_quoted_values);
+
+// Double quoted strings
+$double_quoted_values = array(
+ 0 => " ", 1 => "test", 3 => "Hello", 4 => "HELLO",
+ 5 => "", 6 => "\t", 7 => "0", 8 => "123Hello",
+ 9 => "\"", 10 => "@#$%"
+);
+
+echo "\n-- Sorting Double Quoted String values --\n";
+var_dump( usort($double_quoted_values, 'cmp_function') );
+var_dump($double_quoted_values);
+
+// Heredoc strings
+$heredoc_values = array(0 => $empty_heredoc, 1 => $simple_heredoc1,
+ 2 => $simple_heredoc2, 3 => $multiline_heredoc);
+
+echo "\n-- Sorting Heredoc String values --\n";
+var_dump( usort($heredoc_values, 'cmp_function') );
+var_dump($heredoc_values);
+?>
+===DONE===
+--EXPECTF--
+*** Testing usort() : usage variation ***
+
+-- Sorting Single Quoted String values --
+bool(true)
+array(10) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(1) " "
+ [2]=>
+ string(1) "'"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(8) "123Hello"
+ [5]=>
+ string(4) "@#$%"
+ [6]=>
+ string(5) "HELLO"
+ [7]=>
+ string(5) "Hello"
+ [8]=>
+ string(2) "\t"
+ [9]=>
+ string(4) "test"
+}
+
+-- Sorting Double Quoted String values --
+bool(true)
+array(10) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(1) " "
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(1) """
+ [4]=>
+ string(1) "0"
+ [5]=>
+ string(8) "123Hello"
+ [6]=>
+ string(4) "@#$%"
+ [7]=>
+ string(5) "HELLO"
+ [8]=>
+ string(5) "Hello"
+ [9]=>
+ string(4) "test"
+}
+
+-- Sorting Heredoc String values --
+bool(true)
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(7) "HEREDOC"
+ [2]=>
+ string(7) "Heredoc"
+ [3]=>
+ string(%d) "heredoc string with!@# and 123
+Test this!!!"
+}
+===DONE===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test usort() function : usage variations - multi-dimensional arrays
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass a multi-dimensional array as $array_arg argument to usort()
+ * to test how array is re-ordered
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+$array_args = array(
+ 0 => array(2, 10, -1),
+ 1 => array(100),
+ 2 => array(),
+ 3 => array(0),
+ 4 => array(-1),
+ 5 => array(-9, 34, 54, 0, 20),
+ 6 => array(''),
+ 7 => array("apple", "Apple", "APPLE", "aPPle", "aPpLe")
+);
+
+$temp_array = $array_args;
+
+echo "\n-- Pass usort() a two-dimensional array --\n";
+// sorting array_arg as whole array
+var_dump( usort($temp_array, 'cmp_function') );
+
+echo "-- Array after call to usort() --\n";
+var_dump($temp_array);
+
+echo "\n-- Pass usort() a sub-array --\n";
+var_dump( usort($array_args[5], 'cmp_function') );
+
+echo "-- Array after call to usort() --\n";
+var_dump($array_args[5]);
+?>
+===DONE===
+--EXPECTF--
+*** Testing usort() : usage variation ***
+
+-- Pass usort() a two-dimensional array --
+bool(true)
+-- Array after call to usort() --
+array(8) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(-1)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [4]=>
+ array(1) {
+ [0]=>
+ int(100)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(-1)
+ }
+ [6]=>
+ array(5) {
+ [0]=>
+ int(-9)
+ [1]=>
+ int(34)
+ [2]=>
+ int(54)
+ [3]=>
+ int(0)
+ [4]=>
+ int(20)
+ }
+ [7]=>
+ array(5) {
+ [0]=>
+ string(5) "apple"
+ [1]=>
+ string(5) "Apple"
+ [2]=>
+ string(5) "APPLE"
+ [3]=>
+ string(5) "aPPle"
+ [4]=>
+ string(5) "aPpLe"
+ }
+}
+
+-- Pass usort() a sub-array --
+bool(true)
+-- Array after call to usort() --
+array(5) {
+ [0]=>
+ int(-9)
+ [1]=>
+ int(0)
+ [2]=>
+ int(20)
+ [3]=>
+ int(34)
+ [4]=>
+ int(54)
+}
+===DONE===
--- /dev/null
+--TEST--
+Test usort() function : usage variations - Anonymous comparison function
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an anonymous comparison function as $cmp_function argument to test behaviour()
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+$cmp_function = 'if($value1 == $value2) {return 0;} else if($value1 > $value2) {return 1;} else{return -1;}';
+
+$array_arg = array(0 => 100, 1 => 3, 2 => -70, 3 => 24, 4 => 90);
+
+echo "\n-- Anonymous 'cmp_function' with parameters passed by value --\n";
+var_dump( usort($array_arg, create_function('$value1, $value2',$cmp_function) ) );
+var_dump($array_arg);
+
+$array_arg = array("b" => "Banana", "m" => "Mango", "a" => "Apple", "p" => "Pineapple");
+
+echo "\n-- Anonymous 'cmp_function' with parameters passed by reference --\n";
+var_dump( usort($array_arg, create_function('&$value1, &$value2', $cmp_function) ) );
+var_dump($array_arg);
+?>
+===DONE===
+--EXPECTF--
+*** Testing usort() : usage variation ***
+
+-- Anonymous 'cmp_function' with parameters passed by value --
+bool(true)
+array(5) {
+ [0]=>
+ int(-70)
+ [1]=>
+ int(3)
+ [2]=>
+ int(24)
+ [3]=>
+ int(90)
+ [4]=>
+ int(100)
+}
+
+-- Anonymous 'cmp_function' with parameters passed by reference --
+bool(true)
+array(4) {
+ [0]=>
+ string(5) "Apple"
+ [1]=>
+ string(6) "Banana"
+ [2]=>
+ string(5) "Mango"
+ [3]=>
+ string(9) "Pineapple"
+}
+===DONE===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test usort() function : usage variations - use built in functions as $cmp_function arg
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test usort() when comparison function is:
+ * 1. a built in comparison function
+ * 2. a language construct
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+// Initializing variables
+$array_arg = array("b" => "Banana", "m" => "Mango", "a" => "apple",
+ "p" => "Pineapple", "o" => "orange");
+
+// Testing library functions as comparison function
+echo "\n-- Testing usort() with built-in 'cmp_function': strcasecmp() --\n";
+$temp_array1 = $array_arg;
+var_dump( usort($temp_array1, 'strcasecmp') );
+var_dump($temp_array1);
+
+echo "\n-- Testing usort() with built-in 'cmp_function': strcmp() --\n";
+$temp_array2 = $array_arg;
+var_dump( usort($temp_array2, 'strcmp') );
+var_dump($temp_array2);
+
+// Testing with language construct as comparison function
+echo "\n-- Testing usort() with language construct as 'cmp_function' --\n";
+$temp_array3 = $array_arg;
+var_dump( usort($temp_array3, 'echo') );
+
+echo "\n-- Testing usort() with language construct as 'cmp_function' --\n";
+$temp_array4 = $array_arg;
+var_dump( usort($temp_array4, 'exit') );
+?>
+===DONE===
+--EXPECTF--
+*** Testing usort() : usage variation ***
+
+-- Testing usort() with built-in 'cmp_function': strcasecmp() --
+bool(true)
+array(5) {
+ [0]=>
+ string(5) "apple"
+ [1]=>
+ string(6) "Banana"
+ [2]=>
+ string(5) "Mango"
+ [3]=>
+ string(6) "orange"
+ [4]=>
+ string(9) "Pineapple"
+}
+
+-- Testing usort() with built-in 'cmp_function': strcmp() --
+bool(true)
+array(5) {
+ [0]=>
+ string(6) "Banana"
+ [1]=>
+ string(5) "Mango"
+ [2]=>
+ string(9) "Pineapple"
+ [3]=>
+ string(5) "apple"
+ [4]=>
+ string(6) "orange"
+}
+
+-- Testing usort() with language construct as 'cmp_function' --
+
+Warning: usort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
+NULL
+
+-- Testing usort() with language construct as 'cmp_function' --
+
+Warning: usort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d
+NULL
+===DONE===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test usort() function : usage variations - referenced variables
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array of referenced variables as $array_arg to test behaviour
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $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===