summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnt Phillips <ant@php.net>2008-12-02 13:29:17 +0000
committerAnt Phillips <ant@php.net>2008-12-02 13:29:17 +0000
commitba7bc0ace477f35d645c40adcb2d6d10d321872d (patch)
treefd86eb7600e690403f63481acbcae160d59f51a6
parent8862c5d405860c0a5418eb9283796ec87105fbb9 (diff)
downloadphp-git-ba7bc0ace477f35d645c40adcb2d6d10d321872d.tar.gz
Array tests: checked on PHP 5.2.6, 5.3 and 6.0 (Windows, Linux and Linux 64 bit).
-rw-r--r--ext/standard/tests/array/array_count_values_error.phpt50
-rw-r--r--ext/standard/tests/array/array_count_values_variation.phpt47
-rw-r--r--ext/standard/tests/array/array_diff_assoc_error.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_key_error.phpt36
-rw-r--r--ext/standard/tests/array/array_diff_key_variation1.phpt391
-rw-r--r--ext/standard/tests/array/array_diff_key_variation2.phpt311
-rw-r--r--ext/standard/tests/array/array_diff_key_variation3.phpt232
-rw-r--r--ext/standard/tests/array/array_diff_key_variation4.phpt62
-rw-r--r--ext/standard/tests/array/array_diff_key_variation5.phpt34
-rw-r--r--ext/standard/tests/array/array_diff_key_variation6.phpt36
-rw-r--r--ext/standard/tests/array/array_diff_key_variation7.phpt59
-rw-r--r--ext/standard/tests/array/array_diff_key_variation8.phpt54
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_error.phpt1
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation14.phpt40
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation11.phpt53
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation3.phpt2
-rw-r--r--ext/standard/tests/array/array_fill_keys_error.phpt49
-rw-r--r--ext/standard/tests/array/array_fill_keys_variation1.phpt79
-rw-r--r--ext/standard/tests/array/array_fill_keys_variation2.phpt81
-rw-r--r--ext/standard/tests/array/array_fill_keys_variation3.phpt54
-rw-r--r--ext/standard/tests/array/array_fill_keys_variation4.phpt91
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation5.phpt32
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation6.phpt34
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation2.phpt1
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation3.phpt1
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation10.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation11.phpt51
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation10.phpt52
-rw-r--r--ext/standard/tests/array/array_intersect_variation5.phpt30
-rw-r--r--ext/standard/tests/array/array_intersect_variation6.phpt30
-rw-r--r--ext/standard/tests/array/array_map_variation19.phpt40
-rw-r--r--ext/standard/tests/array/array_multisort_basic1.phpt26
-rw-r--r--ext/standard/tests/array/array_multisort_basic2.phpt6
-rw-r--r--ext/standard/tests/array/array_multisort_variation5.phpt2
-rw-r--r--ext/standard/tests/array/array_multisort_variation6.phpt2
-rw-r--r--ext/standard/tests/array/array_multisort_variation7.phpt6
-rw-r--r--ext/standard/tests/array/array_multisort_variation8.phpt6
-rw-r--r--ext/standard/tests/array/array_multisort_variation9.phpt4
-rw-r--r--ext/standard/tests/array/array_next_error1.phpt13
-rw-r--r--ext/standard/tests/array/array_next_error2.phpt12
-rw-r--r--ext/standard/tests/array/array_product_error.phpt2
-rw-r--r--ext/standard/tests/array/array_product_variation2.phpt6
-rw-r--r--ext/standard/tests/array/array_product_variation3.phpt2
-rw-r--r--ext/standard/tests/array/array_product_variation4.phpt2
-rw-r--r--ext/standard/tests/array/array_product_variation5.phpt2
-rw-r--r--ext/standard/tests/array/array_rand_variation4.phpt2
-rw-r--r--ext/standard/tests/array/array_reduce_error.phpt41
-rw-r--r--ext/standard/tests/array/array_reduce_variation1.phpt44
-rw-r--r--ext/standard/tests/array/array_reduce_variation2.phpt35
-rw-r--r--ext/standard/tests/array/array_reduce_variation3.phpt36
-rw-r--r--ext/standard/tests/array/array_slice_variation1.phpt264
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_error.phpt42
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation.phpt36
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation1.phpt227
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation2.phpt227
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation3.phpt251
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation5.phpt60
-rw-r--r--ext/standard/tests/array/array_udiff_error.phpt42
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_error.phpt44
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation1.phpt228
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation2.phpt228
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation3.phpt254
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation4.phpt254
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation5.phpt229
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation6.phpt58
-rw-r--r--ext/standard/tests/array/array_udiff_variation1.phpt227
-rw-r--r--ext/standard/tests/array/array_udiff_variation2.phpt227
-rw-r--r--ext/standard/tests/array/array_udiff_variation3.phpt251
-rw-r--r--ext/standard/tests/array/array_udiff_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_udiff_variation5.phpt55
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_basic2.phpt36
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_error.phpt43
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation1.phpt227
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation2.phpt227
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation3.phpt251
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation5.phpt54
-rw-r--r--ext/standard/tests/array/array_uintersect_error.phpt45
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_error.phpt45
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt228
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt228
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation3.phpt254
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation4.phpt254
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt229
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt56
-rw-r--r--ext/standard/tests/array/array_uintersect_variation1.phpt227
-rw-r--r--ext/standard/tests/array/array_uintersect_variation2.phpt227
-rw-r--r--ext/standard/tests/array/array_uintersect_variation3.phpt251
-rw-r--r--ext/standard/tests/array/array_uintersect_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_uintersect_variation5.phpt58
-rw-r--r--ext/standard/tests/array/array_unshift_variation1.phpt4
-rw-r--r--ext/standard/tests/array/array_values_error.phpt42
-rw-r--r--ext/standard/tests/array/array_values_variation7.phpt4
-rw-r--r--ext/standard/tests/array/arsort_basic.phpt133
-rw-r--r--ext/standard/tests/array/arsort_object1.phpt90
-rw-r--r--ext/standard/tests/array/arsort_object2.phpt94
-rw-r--r--ext/standard/tests/array/arsort_variation3.phpt24
-rw-r--r--ext/standard/tests/array/bug44181.phpt18
-rw-r--r--ext/standard/tests/array/bug44182.phpt19
-rw-r--r--ext/standard/tests/array/compact_variation1.phpt29
-rw-r--r--ext/standard/tests/array/compact_variation2.phpt40
-rw-r--r--ext/standard/tests/array/compare_function.inc13
-rw-r--r--ext/standard/tests/array/current_basic.phpt2
-rw-r--r--ext/standard/tests/array/current_variation1.phpt3
-rw-r--r--ext/standard/tests/array/current_variation3.phpt2
-rw-r--r--ext/standard/tests/array/current_variation4.phpt2
-rw-r--r--ext/standard/tests/array/each_basic.phpt4
-rw-r--r--ext/standard/tests/array/each_error.phpt1
-rw-r--r--ext/standard/tests/array/each_variation2.phpt2
-rw-r--r--ext/standard/tests/array/each_variation3.phpt4
-rw-r--r--ext/standard/tests/array/each_variation4.phpt2
-rw-r--r--ext/standard/tests/array/each_variation5.phpt4
-rw-r--r--ext/standard/tests/array/each_variation6.phpt4
-rw-r--r--ext/standard/tests/array/end_basic.phpt2
-rw-r--r--ext/standard/tests/array/end_variation1.phpt5
-rw-r--r--ext/standard/tests/array/end_variation2.phpt2
-rw-r--r--ext/standard/tests/array/end_variation3.phpt2
-rw-r--r--ext/standard/tests/array/key_basic.phpt2
-rw-r--r--ext/standard/tests/array/key_variation1.phpt5
-rw-r--r--ext/standard/tests/array/key_variation2.phpt2
-rw-r--r--ext/standard/tests/array/key_variation3.phpt2
-rw-r--r--ext/standard/tests/array/key_variation4.phpt2
-rw-r--r--ext/standard/tests/array/natcasesort_basic.phpt4
-rw-r--r--ext/standard/tests/array/natcasesort_error.phpt2
-rw-r--r--ext/standard/tests/array/natcasesort_variation1.phpt1
-rw-r--r--ext/standard/tests/array/natcasesort_variation10.phpt2
-rw-r--r--ext/standard/tests/array/natcasesort_variation11.phpt4
-rw-r--r--ext/standard/tests/array/natcasesort_variation2.phpt2
-rw-r--r--ext/standard/tests/array/natcasesort_variation3.phpt4
-rw-r--r--ext/standard/tests/array/natcasesort_variation4.phpt3
-rw-r--r--ext/standard/tests/array/natcasesort_variation5.phpt4
-rw-r--r--ext/standard/tests/array/natcasesort_variation6.phpt4
-rw-r--r--ext/standard/tests/array/natcasesort_variation7.phpt4
-rw-r--r--ext/standard/tests/array/natcasesort_variation8.phpt4
-rw-r--r--ext/standard/tests/array/natcasesort_variation9.phpt4
-rw-r--r--ext/standard/tests/array/natsort_basic.phpt35
-rw-r--r--ext/standard/tests/array/next_basic.phpt2
-rw-r--r--ext/standard/tests/array/next_variation1.phpt5
-rw-r--r--ext/standard/tests/array/next_variation2.phpt2
-rwxr-xr-xext/standard/tests/array/prev_variation1.phpt5
-rw-r--r--ext/standard/tests/array/reset_basic.phpt2
-rw-r--r--ext/standard/tests/array/reset_variation1.phpt5
-rw-r--r--ext/standard/tests/array/reset_variation2.phpt2
-rw-r--r--ext/standard/tests/array/reset_variation3.phpt2
-rw-r--r--ext/standard/tests/array/rsort_basic.phpt12
-rw-r--r--ext/standard/tests/array/rsort_error.phpt2
-rw-r--r--ext/standard/tests/array/rsort_object1.phpt8
-rw-r--r--ext/standard/tests/array/rsort_object2.phpt8
-rw-r--r--ext/standard/tests/array/rsort_variation1.phpt2
-rw-r--r--ext/standard/tests/array/rsort_variation10.phpt4
-rw-r--r--ext/standard/tests/array/rsort_variation11.phptbin2715 -> 2715 bytes
-rw-r--r--ext/standard/tests/array/rsort_variation2.phpt2
-rw-r--r--ext/standard/tests/array/rsort_variation3.phpt18
-rw-r--r--ext/standard/tests/array/rsort_variation4.phpt6
-rw-r--r--ext/standard/tests/array/rsort_variation5.phpt4
-rw-r--r--ext/standard/tests/array/rsort_variation6.phpt8
-rw-r--r--ext/standard/tests/array/rsort_variation7.phpt8
-rw-r--r--ext/standard/tests/array/rsort_variation8.phpt4
-rw-r--r--ext/standard/tests/array/rsort_variation9.phpt4
-rw-r--r--ext/standard/tests/array/uksort_basic.phpt26
-rw-r--r--ext/standard/tests/array/uksort_error.phpt45
-rw-r--r--ext/standard/tests/array/uksort_variation1.phpt224
-rw-r--r--ext/standard/tests/array/uksort_variation2.phpt224
-rw-r--r--ext/standard/tests/array/usort_basic.phpt119
-rw-r--r--ext/standard/tests/array/usort_error1.phpt41
-rw-r--r--ext/standard/tests/array/usort_error2.phpt56
-rw-r--r--ext/standard/tests/array/usort_object1.phpt141
-rw-r--r--ext/standard/tests/array/usort_object2.phpt165
-rw-r--r--ext/standard/tests/array/usort_variation1.phpt236
-rw-r--r--ext/standard/tests/array/usort_variation10.phpt79
-rw-r--r--ext/standard/tests/array/usort_variation2.phpt242
-rw-r--r--ext/standard/tests/array/usort_variation3.phpt115
-rw-r--r--ext/standard/tests/array/usort_variation4.phpt155
-rw-r--r--ext/standard/tests/array/usort_variation5.phpt143
-rw-r--r--ext/standard/tests/array/usort_variation6.phpt139
-rw-r--r--ext/standard/tests/array/usort_variation7.phpt61
-rw-r--r--ext/standard/tests/array/usort_variation8.phpt85
-rw-r--r--ext/standard/tests/array/usort_variation9.phpt66
179 files changed, 12056 insertions, 404 deletions
diff --git a/ext/standard/tests/array/array_count_values_error.phpt b/ext/standard/tests/array/array_count_values_error.phpt
new file mode 100644
index 0000000000..843e34ee59
--- /dev/null
+++ b/ext/standard/tests/array/array_count_values_error.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test array_count_values() function : Invalid parameters
+--FILE--
+<?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
diff --git a/ext/standard/tests/array/array_count_values_variation.phpt b/ext/standard/tests/array/array_count_values_variation.phpt
new file mode 100644
index 0000000000..488b04e57c
--- /dev/null
+++ b/ext/standard/tests/array/array_count_values_variation.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test array_count_values() function : Test all normal paramter variations
+--FILE--
+<?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) {
+ [u"bobv"]=>
+ int(1)
+ [u"val"]=>
+ int(1)
+ [u"val6"]=>
+ int(1)
+}
+
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_assoc_error.phpt b/ext/standard/tests/array/array_diff_assoc_error.phpt
index 1aa7a08bc5..211907c726 100644
--- a/ext/standard/tests/array/array_diff_assoc_error.phpt
+++ b/ext/standard/tests/array/array_diff_assoc_error.phpt
@@ -38,4 +38,4 @@ NULL
Warning: array_diff_assoc(): at least 2 parameters are required, 1 given in %s on line %d
NULL
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_key_error.phpt b/ext/standard/tests/array/array_diff_key_error.phpt
new file mode 100644
index 0000000000..90168f5de6
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_key_error.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test array_diff_key() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : error conditions ***\n";
+
+// Initialise the variables
+$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
+
+// Testing array_diff_key with one less than the expected number of arguments
+echo "\n-- Testing array_diff_key() function with less than expected no. of arguments --\n";
+var_dump( array_diff_key($array1) );
+
+// Testing array_diff_key with no arguments
+echo "\n-- Testing array_diff_key() function with no arguments --\n";
+var_dump( array_diff_key() );
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_diff_key() : error conditions ***
+
+-- Testing array_diff_key() function with less than expected no. of arguments --
+
+Warning: array_diff_key(): at least 2 parameters are required, 1 given in %s on line %d
+NULL
+
+-- Testing array_diff_key() function with no arguments --
+
+Warning: array_diff_key(): at least 2 parameters are required, 0 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/array/array_diff_key_variation1.phpt b/ext/standard/tests/array/array_diff_key_variation1.phpt
index b322a5fa93..52b703fb77 100644
--- a/ext/standard/tests/array/array_diff_key_variation1.phpt
+++ b/ext/standard/tests/array/array_diff_key_variation1.phpt
@@ -1,89 +1,310 @@
--TEST--
-array_diff_key() : type variations
+Test array_diff_key() function : usage variation - Passing unexpected values to first argument
--FILE--
<?php
-/*
-* proto array array_diff_key(array arr1, array arr2 [, array ...])
-* Function is implemented in ext/standard/array.c
-*/
-/*
-* Testing how array_diff_key treats keys that are numbers, floating point numbers or strings.
-*/
-$arr1 = array(1 => 'a', 2 => 'b', 3 => 'c', 'key1' => 'value');
-$arr2 = array(1.00 => 'a', 2.00 => 'b', 3.00 => 'c', 'key2' => 'value');
-$arr3 = array('1' => 'a', '2' => 'b', '3' => 'c', 'key3' => 'value');
-$arr4 = array('1.00' => 'a', '2.00' => 'b', '3.00' => 'c', 'key4' => 'value'); //$arr4 looks different to the other three arrays.
-print "Result of comparing integers and floating point value:\n"; //1 and 1.00 are treated as the same thing
-print_r(array_diff_key($arr1, $arr2));
-print_r(array_diff_key($arr2, $arr1));
-print "Result of comparing integers and strings containing an integers:\n"; //1 and the string 1 are treated as the same thing
-print_r(array_diff_key($arr1, $arr3));
-print_r(array_diff_key($arr3, $arr1));
-print "Result of comparing integers and strings containing floating points:\n"; //1 and the string 1.00 are not treated as the same thing
-print_r(array_diff_key($arr1, $arr4));
-print_r(array_diff_key($arr4, $arr1));
-print "Result of comparing floating points and strings containing integers:\n";
-print_r(array_diff_key($arr2, $arr3)); //1.00 and the string 1 are treated as the same thing
-print_r(array_diff_key($arr3, $arr2));
-print "Result of comparing strings containing integers and strings containing floating points:\n"; //the strings 1 and 1.00 are not treated as the same thing.
-print_r(array_diff_key($arr3, $arr4));
-print_r(array_diff_key($arr4, $arr3));
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
+$array3 = array(1, 2, 3, 4, 5);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//resource variable
+$fp = fopen(__FILE__, "r");
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource data
+ 'resource' => $fp,
+);
+
+// loop through each element of the array for arr1
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( array_diff_key($value, $array2) );
+ var_dump( array_diff_key($value, $array2, $array3) );
+};
+
+fclose($fp);
?>
---EXPECT--
-Result of comparing integers and floating point value:
-Array
-(
- [key1] => value
-)
-Array
-(
- [key2] => value
-)
-Result of comparing integers and strings containing an integers:
-Array
-(
- [key1] => value
-)
-Array
-(
- [key3] => value
-)
-Result of comparing integers and strings containing floating points:
-Array
-(
- [1] => a
- [2] => b
- [3] => c
- [key1] => value
-)
-Array
-(
- [1.00] => a
- [2.00] => b
- [3.00] => c
- [key4] => value
-)
-Result of comparing floating points and strings containing integers:
-Array
-(
- [key2] => value
-)
-Array
-(
- [key3] => value
-)
-Result of comparing strings containing integers and strings containing floating points:
-Array
-(
- [1] => a
- [2] => b
- [3] => c
- [key3] => value
-)
-Array
-(
- [1.00] => a
- [2.00] => b
- [3.00] => c
- [key4] => value
-)
+===DONE===
+--EXPECTF--
+*** Testing array_diff_key() : usage variation ***
+
+--int 0--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--int 1--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--int 12345--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--int -12345--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--float 10.5--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--float -10.5--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--float 12.3456789000e10--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--float -12.3456789000e10--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--float .5--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--uppercase NULL--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--lowercase null--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--lowercase true--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--lowercase false--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--uppercase TRUE--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--uppercase FALSE--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--empty string DQ--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--empty string SQ--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--string DQ--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--string SQ--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--mixed case string--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--heredoc--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--instance of classWithToString--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--instance of classWithoutToString--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--undefined var--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--unset var--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+--resource--
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #1 is not an array in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_key_variation2.phpt b/ext/standard/tests/array/array_diff_key_variation2.phpt
new file mode 100644
index 0000000000..737ee2e57f
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_key_variation2.phpt
@@ -0,0 +1,311 @@
+--TEST--
+Test array_diff_key() function : usage variation - Passing unexpected values to second argument
+--FILE--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array1 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
+$array3 = array(1, 2, 3, 4, 5);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//resource variable
+$fp = fopen(__FILE__, "r");
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource data
+ 'resource' => $fp,
+);
+
+// loop through each element of the array for arr1
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( array_diff_key($array1, $value) );
+ var_dump( array_diff_key($array1, $value, $array3) );
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_diff_key() : usage variation ***
+
+--int 0--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--int 1--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--int 12345--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--int -12345--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--float 10.5--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--float -10.5--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--float 12.3456789000e10--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--float -12.3456789000e10--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--float .5--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--uppercase NULL--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--lowercase null--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--lowercase true--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--lowercase false--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--uppercase TRUE--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--uppercase FALSE--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--empty string DQ--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--empty string SQ--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--string DQ--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--string SQ--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--mixed case string--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--heredoc--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--instance of classWithToString--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--instance of classWithoutToString--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--undefined var--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--unset var--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+--resource--
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_diff_key(): Argument #2 is not an array in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_key_variation3.phpt b/ext/standard/tests/array/array_diff_key_variation3.phpt
new file mode 100644
index 0000000000..28f4c05529
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_key_variation3.phpt
@@ -0,0 +1,232 @@
+--TEST--
+Test array_diff_key() function : usage variation - Passing unexpected values to third optional argument
+--FILE--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
+$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//resource variable
+$fp = fopen(__FILE__, "r");
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource data
+ 'resource' => $fp,
+);
+
+// loop through each element of the array for arr1
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( array_diff_key($array1, $array2, $value) );
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_diff_key() : usage variation ***
+
+--int 0--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--int 1--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--int 12345--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--int -12345--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--float 10.5--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--float -10.5--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--float 12.3456789000e10--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--float -12.3456789000e10--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--float .5--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--uppercase NULL--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--lowercase null--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--lowercase true--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--lowercase false--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--uppercase TRUE--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--uppercase FALSE--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--empty string DQ--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--empty string SQ--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--string DQ--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--string SQ--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--mixed case string--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--heredoc--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--instance of classWithToString--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--instance of classWithoutToString--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--undefined var--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--unset var--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+
+--resource--
+
+Warning: array_diff_key(): Argument #3 is not an array in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_key_variation4.phpt b/ext/standard/tests/array/array_diff_key_variation4.phpt
new file mode 100644
index 0000000000..d64f990468
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_key_variation4.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test array_diff_key() function : usage variation - Passing integer indexed array
+--FILE--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(-07 => '-07', 0xA => '0xA');
+
+$input_arrays = array(
+ 'decimal indexed' => array(10 => '10', '-17' => '-17'),
+ 'octal indexed' => array(-011 => '-011', 012 => '012'),
+ 'hexa indexed' => array(0x12 => '0x12', -0x7 => '-0x7', ),
+);
+
+// loop through each element of the array for arr1
+foreach($input_arrays as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( array_diff_key($input_array, $value) );
+ var_dump( array_diff_key($value, $input_array) );
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_diff_key() : usage variation ***
+
+--decimal indexed--
+array(1) {
+ [-7]=>
+ unicode(3) "-07"
+}
+array(1) {
+ [-17]=>
+ unicode(3) "-17"
+}
+
+--octal indexed--
+array(1) {
+ [-7]=>
+ unicode(3) "-07"
+}
+array(1) {
+ [-9]=>
+ unicode(4) "-011"
+}
+
+--hexa indexed--
+array(1) {
+ [10]=>
+ unicode(3) "0xA"
+}
+array(1) {
+ [18]=>
+ unicode(4) "0x12"
+}
+===DONE===
+
diff --git a/ext/standard/tests/array/array_diff_key_variation5.phpt b/ext/standard/tests/array/array_diff_key_variation5.phpt
new file mode 100644
index 0000000000..ba98a2e68d
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_key_variation5.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test array_diff_key() function : usage variation - Passing float indexed array
+--FILE--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(0 => '0', 10 => '10', -10 => '-10', 20 =>'20', -20 => '-20');
+$float_indx_array = array(0.0 => '0.0', 10.5 => '10.5', -10.5 => '-10.5', 0.5 => '0.5');
+
+echo "\n-- Testing array_diff_key() function with float indexed array --\n";
+// loop through each element of the array for arr1
+var_dump( array_diff_key($input_array, $float_indx_array) );
+var_dump( array_diff_key($float_indx_array, $input_array) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_diff_key() : usage variation ***
+
+-- Testing array_diff_key() function with float indexed array --
+array(2) {
+ [20]=>
+ unicode(2) "20"
+ [-20]=>
+ unicode(3) "-20"
+}
+array(0) {
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_key_variation6.phpt b/ext/standard/tests/array/array_diff_key_variation6.phpt
new file mode 100644
index 0000000000..eec9934935
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_key_variation6.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test array_diff_key() function : usage variation - Passing boolean indexed array
+--FILE--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(0 => '0', 1 => '1', -10 => '-10', 'true' => 1, 'false' => 0);
+$boolean_indx_array = array(true => 'boolt', false => 'boolf', TRUE => 'boolT', FALSE => 'boolF');
+
+echo "\n-- Testing array_diff_key() function with boolean indexed array --\n";
+// loop through each element of the array for arr1
+var_dump( array_diff_key($input_array, $boolean_indx_array) );
+var_dump( array_diff_key($boolean_indx_array, $input_array) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_diff_key() : usage variation ***
+
+-- Testing array_diff_key() function with boolean indexed array --
+array(3) {
+ [-10]=>
+ unicode(3) "-10"
+ [u"true"]=>
+ int(1)
+ [u"false"]=>
+ int(0)
+}
+array(0) {
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_key_variation7.phpt b/ext/standard/tests/array/array_diff_key_variation7.phpt
new file mode 100644
index 0000000000..76b747c479
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_key_variation7.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test array_diff_key() function : usage variation - Passing null,unset and undefined variable indexed array
+--FILE--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(10 => '10', "" => 'empty');
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+$input_arrays = array(
+ 'null indexed' => array(NULL => 'null 1', null => 'null 2'),
+ 'undefined indexed' => array(@$undefined_var => 'undefined'),
+ 'unset indexed' => array(@$unset_var => 'unset'),
+);
+
+foreach($input_arrays as $key =>$value) {
+ echo "\n--$key--\n";
+ // loop through each element of the array for arr1
+ var_dump( array_diff_key($input_array, $value) );
+ var_dump( array_diff_key($value, $input_array) );
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_diff_key() : usage variation ***
+
+--null indexed--
+array(1) {
+ [10]=>
+ unicode(2) "10"
+}
+array(0) {
+}
+
+--undefined indexed--
+array(1) {
+ [10]=>
+ unicode(2) "10"
+}
+array(0) {
+}
+
+--unset indexed--
+array(1) {
+ [10]=>
+ unicode(2) "10"
+}
+array(0) {
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_key_variation8.phpt b/ext/standard/tests/array/array_diff_key_variation8.phpt
new file mode 100644
index 0000000000..f8106d8af3
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_key_variation8.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test array_diff_key() function : usage variation - Passing multi-dimensional array
+--FILE--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array1 = array(
+
+ 'first' => array('blue' => 1, 'red' => 2),
+
+ 'second' => array('yellow' => 7),
+
+ 'third' => array(0 => 'zero'),
+);
+
+$array2 = array (
+
+ 'first' => array('blue' => 1, 'red' => 2,),
+
+ 'second' => array('cyan' => 8),
+
+ 'fourth' => array(2 => 'two'),
+);
+
+echo "\n-- Testing array_diff_key() function with multi dimensional array --\n";
+var_dump( array_diff_key($array1, $array2) );
+var_dump( array_diff_key($array2, $array1) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_diff_key() : usage variation ***
+
+-- Testing array_diff_key() function with multi dimensional array --
+array(1) {
+ [u"third"]=>
+ array(1) {
+ [0]=>
+ unicode(4) "zero"
+ }
+}
+array(1) {
+ [u"fourth"]=>
+ array(1) {
+ [2]=>
+ unicode(3) "two"
+ }
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_uassoc_error.phpt b/ext/standard/tests/array/array_diff_uassoc_error.phpt
index a2f9820442..0f9f82464c 100644
--- a/ext/standard/tests/array/array_diff_uassoc_error.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_error.phpt
@@ -27,7 +27,6 @@ function key_compare_func($a, $b)
//Test array_diff_uassoc with one more than the expected number of arguments
echo "\n-- Testing array_diff_uassoc() function with more than expected no. of arguments --\n";
-
var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) );
var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) );
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation14.phpt b/ext/standard/tests/array/array_diff_uassoc_variation14.phpt
new file mode 100644
index 0000000000..a98a2800da
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_uassoc_variation14.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test array_diff_uassoc() function : usage variation -Passing classWithoutToString (handling fatal error) to callback
+--FILE--
+<?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===
+
diff --git a/ext/standard/tests/array/array_diff_ukey_variation11.phpt b/ext/standard/tests/array/array_diff_ukey_variation11.phpt
new file mode 100644
index 0000000000..4882e729b5
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_ukey_variation11.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test array_diff_ukey() function : usage variation - Passing class without string to callback (Handling fatal error)
+--SKIPIF--
+<?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
diff --git a/ext/standard/tests/array/array_diff_ukey_variation3.phpt b/ext/standard/tests/array/array_diff_ukey_variation3.phpt
index 309dae45a4..f7a2ea8620 100644
--- a/ext/standard/tests/array/array_diff_ukey_variation3.phpt
+++ b/ext/standard/tests/array/array_diff_ukey_variation3.phpt
@@ -3,7 +3,7 @@ Test array_diff_ukey() function : usage variation - Passing unexpected values to
--FILE--
<?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.
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
* Source code: ext/standard/array.c
*/
diff --git a/ext/standard/tests/array/array_fill_keys_error.phpt b/ext/standard/tests/array/array_fill_keys_error.phpt
new file mode 100644
index 0000000000..64fd0e528e
--- /dev/null
+++ b/ext/standard/tests/array/array_fill_keys_error.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test array_fill_keys() function : error conditions
+--FILE--
+<?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
diff --git a/ext/standard/tests/array/array_fill_keys_variation1.phpt b/ext/standard/tests/array/array_fill_keys_variation1.phpt
new file mode 100644
index 0000000000..796a9be9cd
--- /dev/null
+++ b/ext/standard/tests/array/array_fill_keys_variation1.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test array_fill_keys() function : variation of parameter
+--FILE--
+<?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]=>
+ unicode(6) "simple"
+ [u"strv1"]=>
+ unicode(6) "simple"
+ [4]=>
+ unicode(6) "simple"
+ [u"simple"]=>
+ unicode(6) "simple"
+}
+
+-- Testing array_fill_keys() function with mixed array --
+
+Notice: Array to string conversion in %sarray_fill_keys_variation1.php on line %d
+array(7) {
+ [u"Resource id #%d"]=>
+ unicode(6) "simple"
+ [u"Class A object"]=>
+ unicode(6) "simple"
+ [u"simple"]=>
+ unicode(6) "simple"
+ [u"Array"]=>
+ unicode(6) "simple"
+ [2]=>
+ unicode(6) "simple"
+ [u""]=>
+ unicode(6) "simple"
+ [u"2.4"]=>
+ unicode(6) "simple"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_fill_keys_variation2.phpt b/ext/standard/tests/array/array_fill_keys_variation2.phpt
new file mode 100644
index 0000000000..df7f389ebb
--- /dev/null
+++ b/ext/standard/tests/array/array_fill_keys_variation2.phpt
@@ -0,0 +1,81 @@
+--TEST--
+Test array_fill_keys() function : variation of parameter
+--FILE--
+<?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) {
+ [u"one"]=>
+ unicode(6) "simple"
+ [u"two"]=>
+ unicode(6) "simple"
+}
+
+-- Testing array_fill_keys() function with reference keys --
+array(2) {
+ [u"one"]=>
+ unicode(6) "simple"
+ [u"simple"]=>
+ unicode(6) "simple"
+}
+array(2) {
+ [u"one"]=>
+ unicode(6) "simple"
+ [u"simple"]=>
+ unicode(6) "simple"
+}
+
+-- Testing array_fill_keys() function with reference array input --
+array(2) {
+ [u"one"]=>
+ unicode(3) "bob"
+ [u"two"]=>
+ unicode(3) "bob"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_fill_keys_variation3.phpt b/ext/standard/tests/array/array_fill_keys_variation3.phpt
new file mode 100644
index 0000000000..09cfadc0e0
--- /dev/null
+++ b/ext/standard/tests/array/array_fill_keys_variation3.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test array_fill_keys() function : variation of parameter
+--FILE--
+<?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) {
+ [u"one"]=>
+ resource(%d) of type (stream)
+ [u"two"]=>
+ resource(%d) of type (stream)
+}
+
+-- Testing array_fill_keys() function with mixed array --
+
+Warning: array_fill_keys() expects parameter 1 to be array, null given in %sarray_fill_keys_variation3.php on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_fill_keys_variation4.phpt b/ext/standard/tests/array/array_fill_keys_variation4.phpt
new file mode 100644
index 0000000000..0a1659f135
--- /dev/null
+++ b/ext/standard/tests/array/array_fill_keys_variation4.phpt
@@ -0,0 +1,91 @@
+--TEST--
+Test array_fill_keys() function : variation of parameter
+--FILE--
+<?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) {
+ [u"one"]=>
+ float(2.4)
+}
+
+-- Testing array_fill_keys() function with null --
+array(1) {
+ [u"one"]=>
+ NULL
+}
+
+-- Testing array_fill_keys() function with object --
+array(1) {
+ [u"one"]=>
+ object(classA)#%d (0) {
+ }
+}
+
+-- Testing array_fill_keys() function with boolean --
+array(1) {
+ [u"one"]=>
+ bool(false)
+}
+
+-- Testing array_fill_keys() function with resource --
+array(1) {
+ [u"one"]=>
+ resource(%d) of type (stream)
+}
+
+-- Testing array_fill_keys() function with unset var --
+
+Notice: Undefined variable: unset_var in %sarray_fill_keys_variation4.php on line %d
+array(1) {
+ [u"one"]=>
+ NULL
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation5.phpt b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt
index be308a48d3..36b99028e6 100644
--- a/ext/standard/tests/array/array_intersect_assoc_variation5.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt
@@ -20,17 +20,6 @@ echo "*** Testing array_intersect_assoc() : assoc array with diff keys to \$arr1
$unset_var = 10;
unset ($unset_var);
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// get a class
-class classA
-{
- public function __toString(){
- return "Class A object";
- }
-}
-
// get a heredoc string
$heredoc = <<<EOT
Hello world
@@ -61,18 +50,18 @@ $arrays = array (
array("hello", $heredoc => "string"), // heredoc
// array with object, unset variable and resource variable
-/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+/*10*/ array(@$unset_var => "hello"),
// array with mixed keys
-/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
- $fp => 'resource', 133 => "int", 444.432 => "float",
+/*11*/ array('hello' => 1, "fruit" => 2.2,
+ 133 => "int", 444.432 => "float",
@$unset_var => "unset", $heredoc => "heredoc")
);
// array to be passsed to $arr2 argument
$arr2 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4",
"\tHello" => 111, 2.2, 'color', "Hello world" => "string",
- "pen\n" => 33, new classA() => 11, 133 => "int");
+ "pen\n" => 33, 133 => "int");
// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
$iterator = 1;
@@ -88,23 +77,10 @@ foreach($arrays as $arr1) {
$iterator++;
}
-// close the file resource used
-fclose($fp);
-
echo "Done";
?>
--EXPECTF--
*** Testing array_intersect_assoc() : assoc array with diff keys to $arr1 argument ***
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-- Iteration 1 --
array(0) {
}
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation6.phpt b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt
index 0995993288..ccaaf50217 100644
--- a/ext/standard/tests/array/array_intersect_assoc_variation6.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt
@@ -20,17 +20,6 @@ echo "*** Testing array_intersect_assoc() : assoc array with diff keys to \$arr2
$unset_var = 10;
unset ($unset_var);
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// get a class
-class classA
-{
- public function __toString(){
- return "Class A object";
- }
-}
-
// get a heredoc string
$heredoc = <<<EOT
Hello world
@@ -60,19 +49,19 @@ $arrays = array (
"\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;
@@ -88,23 +77,10 @@ foreach($arrays as $arr2) {
$iterator++;
}
-// close the file resource used
-fclose($fp);
-
echo "Done";
?>
--EXPECTF--
*** Testing array_intersect_assoc() : assoc array with diff keys to $arr2 argument ***
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-- Iteration 1 --
array(0) {
}
diff --git a/ext/standard/tests/array/array_intersect_key_variation2.phpt b/ext/standard/tests/array/array_intersect_key_variation2.phpt
index 9137a602d9..3c33debebe 100644
--- a/ext/standard/tests/array/array_intersect_key_variation2.phpt
+++ b/ext/standard/tests/array/array_intersect_key_variation2.phpt
@@ -92,6 +92,7 @@ $inputs = array(
);
// loop through each element of the array for arr2
+
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
var_dump( array_intersect_key($array1, $value) );
diff --git a/ext/standard/tests/array/array_intersect_key_variation3.phpt b/ext/standard/tests/array/array_intersect_key_variation3.phpt
index 2eaf7213c6..8fd3d3c77f 100644
--- a/ext/standard/tests/array/array_intersect_key_variation3.phpt
+++ b/ext/standard/tests/array/array_intersect_key_variation3.phpt
@@ -92,7 +92,6 @@ $inputs = array(
);
// loop through each element of the array for arr2
-
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
var_dump( array_intersect_key($array1, $array2, $value) );
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt
index 7089e63475..b6a9497082 100644
--- a/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt
+++ b/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt
@@ -22,7 +22,7 @@ class MyClass
public function class_compare_func($a, $b) {
return strcasecmp($a, $b);
}
-
+
}
echo "\n-- Testing array_intersect_uassoc() function using class with static method as callback --\n";
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation11.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation11.phpt
new file mode 100644
index 0000000000..ba3776e202
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_uassoc_variation11.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test array_intersect_uassoc() function : usage variation - Passing class without string to callback (Handling fatal error)
+--SKIPIF--
+<?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===
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation10.phpt b/ext/standard/tests/array/array_intersect_ukey_variation10.phpt
new file mode 100644
index 0000000000..b080eb2300
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_ukey_variation10.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test array_intersect_ukey() function : usage variation - Passing class without string to callback (Handling fatal error)
+--SKIPIF--
+<?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
diff --git a/ext/standard/tests/array/array_intersect_variation5.phpt b/ext/standard/tests/array/array_intersect_variation5.phpt
index abb2407792..d8fc8fe8a5 100644
--- a/ext/standard/tests/array/array_intersect_variation5.phpt
+++ b/ext/standard/tests/array/array_intersect_variation5.phpt
@@ -19,17 +19,6 @@ echo "*** Testing array_intersect() : assoc array with diff keys to \$arr1 argum
$unset_var = 10;
unset ($unset_var);
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// get a class
-class classA
-{
- public function __toString(){
- return "Class A object";
- }
-}
-
// get a heredoc string
$heredoc = <<<EOT
Hello world
@@ -59,12 +48,12 @@ $arrays = array (
"\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")
);
@@ -85,21 +74,10 @@ foreach($arrays as $arr1) {
$iterator++;
}
-// close the file resource used
-fclose($fp);
-
echo "Done";
?>
--EXPECTF--
*** Testing array_intersect() : assoc array with diff keys to $arr1 argument ***
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-- Iterator 1 --
array(0) {
}
diff --git a/ext/standard/tests/array/array_intersect_variation6.phpt b/ext/standard/tests/array/array_intersect_variation6.phpt
index d288b57b6c..326b6f514c 100644
--- a/ext/standard/tests/array/array_intersect_variation6.phpt
+++ b/ext/standard/tests/array/array_intersect_variation6.phpt
@@ -19,17 +19,6 @@ echo "*** Testing array_intersect() : assoc array with diff keys to \$arr2 argum
$unset_var = 10;
unset ($unset_var);
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// get a class
-class classA
-{
- public function __toString(){
- return "Class A object";
- }
-}
-
// get a heredoc string
$heredoc = <<<EOT
Hello world
@@ -59,12 +48,12 @@ $arrays = array (
"\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")
);
@@ -85,21 +74,10 @@ foreach($arrays as $arr2) {
$iterator++;
}
-// close the file resource used
-fclose($fp);
-
echo "Done";
?>
--EXPECTF--
*** Testing array_intersect() : assoc array with diff keys to $arr2 argument ***
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-- Iterator 1 --
array(0) {
}
diff --git a/ext/standard/tests/array/array_map_variation19.phpt b/ext/standard/tests/array/array_map_variation19.phpt
new file mode 100644
index 0000000000..134836ecf7
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation19.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test array_map() function : usage variations - callback pass semantics
+--FILE--
+<?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]=>
+ unicode(10) "original.0"
+ [1]=>
+ unicode(10) "original.1"
+}
+array(2) {
+ [0]=>
+ &unicode(7) "changed"
+ [1]=>
+ unicode(10) "original.1"
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_multisort_basic1.phpt b/ext/standard/tests/array/array_multisort_basic1.phpt
index 3bdf63a925..97475191bd 100644
--- a/ext/standard/tests/array/array_multisort_basic1.phpt
+++ b/ext/standard/tests/array/array_multisort_basic1.phpt
@@ -31,30 +31,30 @@ var_dump($ar2);
-- Testing array_multisort() function with all normal arguments --
bool(true)
array(3) {
- [%u|b%"row2"]=>
+ [u"row2"]=>
int(1)
- [%u|b%"row3"]=>
+ [u"row3"]=>
int(1)
- [%u|b%"row1"]=>
+ [u"row1"]=>
int(2)
}
array(3) {
- [%u|b%"row2"]=>
- %unicode|string%(2) "aa"
- [%u|b%"row3"]=>
- %unicode|string%(1) "1"
- [%u|b%"row1"]=>
+ [u"row2"]=>
+ unicode(2) "aa"
+ [u"row3"]=>
+ unicode(1) "1"
+ [u"row1"]=>
int(2)
}
-- Testing array_multisort() function with one argument --
bool(true)
array(3) {
- [%u|b%"row3"]=>
- %unicode|string%(1) "1"
- [%u|b%"row2"]=>
- %unicode|string%(2) "aa"
- [%u|b%"row1"]=>
+ [u"row3"]=>
+ unicode(1) "1"
+ [u"row2"]=>
+ unicode(2) "aa"
+ [u"row1"]=>
int(2)
}
===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/array_multisort_basic2.phpt b/ext/standard/tests/array/array_multisort_basic2.phpt
index 1ce594c17b..d51283c316 100644
--- a/ext/standard/tests/array/array_multisort_basic2.phpt
+++ b/ext/standard/tests/array/array_multisort_basic2.phpt
@@ -30,14 +30,14 @@ array(3) {
int(1)
[1]=>
int(1)
- [%u|b%"strkey"]=>
+ [u"strkey"]=>
int(2)
}
array(3) {
[0]=>
- %unicode|string%(2) "aa"
+ unicode(2) "aa"
[1]=>
- %unicode|string%(1) "1"
+ unicode(1) "1"
[2]=>
int(2)
}
diff --git a/ext/standard/tests/array/array_multisort_variation5.phpt b/ext/standard/tests/array/array_multisort_variation5.phpt
index d220810785..ad7a25dae4 100644
--- a/ext/standard/tests/array/array_multisort_variation5.phpt
+++ b/ext/standard/tests/array/array_multisort_variation5.phpt
@@ -50,4 +50,4 @@ array(3) {
[2]=>
int(2)
}
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation6.phpt b/ext/standard/tests/array/array_multisort_variation6.phpt
index af209713fc..c3da621662 100644
--- a/ext/standard/tests/array/array_multisort_variation6.phpt
+++ b/ext/standard/tests/array/array_multisort_variation6.phpt
@@ -50,4 +50,4 @@ array(3) {
[2]=>
unicode(2) "aa"
}
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation7.phpt b/ext/standard/tests/array/array_multisort_variation7.phpt
index 106f6002be..ff285b1323 100644
--- a/ext/standard/tests/array/array_multisort_variation7.phpt
+++ b/ext/standard/tests/array/array_multisort_variation7.phpt
@@ -53,10 +53,10 @@ array(10) {
array(0) {
}
[u"instance of classWithToString"]=>
- object(classWithToString)#%d (0) {
+ object(classWithToString)#1 (0) {
}
[u"instance of classWithoutToString"]=>
- object(classWithoutToString)#%d (0) {
+ object(classWithoutToString)#2 (0) {
}
[u"lowercase true"]=>
bool(true)
@@ -65,4 +65,4 @@ array(10) {
[u"string DQ"]=>
unicode(6) "string"
}
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation8.phpt b/ext/standard/tests/array/array_multisort_variation8.phpt
index 9a5ae571b4..3ee3d9a56d 100644
--- a/ext/standard/tests/array/array_multisort_variation8.phpt
+++ b/ext/standard/tests/array/array_multisort_variation8.phpt
@@ -54,7 +54,7 @@ array(10) {
[u"undefined var"]=>
NULL
[u"instance of classWithoutToString"]=>
- object(classWithoutToString)#%d (0) {
+ object(classWithoutToString)#2 (0) {
}
[u"float -10.5"]=>
float(-10.5)
@@ -66,9 +66,9 @@ array(10) {
array(0) {
}
[u"instance of classWithToString"]=>
- object(classWithToString)#%d (0) {
+ object(classWithToString)#1 (0) {
}
[u"string DQ"]=>
unicode(6) "string"
}
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation9.phpt b/ext/standard/tests/array/array_multisort_variation9.phpt
index 4713bbdb1f..ea78774270 100644
--- a/ext/standard/tests/array/array_multisort_variation9.phpt
+++ b/ext/standard/tests/array/array_multisort_variation9.phpt
@@ -67,12 +67,12 @@ array(10) {
array(0) {
}
[u"instance of classWithoutToString"]=>
- object(classWithoutToString)#%d (0) {
+ object(classWithoutToString)#2 (0) {
}
[u"lowercase true"]=>
bool(true)
[u"instance of classWithToString"]=>
- object(classWithToString)#%d (0) {
+ object(classWithToString)#1 (0) {
}
}
===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/array_next_error1.phpt b/ext/standard/tests/array/array_next_error1.phpt
new file mode 100644
index 0000000000..72f2cb9f1d
--- /dev/null
+++ b/ext/standard/tests/array/array_next_error1.phpt
@@ -0,0 +1,13 @@
+--TEST--
+next - ensure warning is received when passing an indirect temporary.
+--FILE--
+<?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
diff --git a/ext/standard/tests/array/array_next_error2.phpt b/ext/standard/tests/array/array_next_error2.phpt
new file mode 100644
index 0000000000..d4f16666ef
--- /dev/null
+++ b/ext/standard/tests/array/array_next_error2.phpt
@@ -0,0 +1,12 @@
+--TEST--
+next - ensure we cannot pass a temporary
+--FILE--
+<?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
diff --git a/ext/standard/tests/array/array_product_error.phpt b/ext/standard/tests/array/array_product_error.phpt
index b8465bc605..2d12a44ffe 100644
--- a/ext/standard/tests/array/array_product_error.phpt
+++ b/ext/standard/tests/array/array_product_error.phpt
@@ -42,4 +42,4 @@ NULL
Warning: array_product() expects parameter 1 to be array, Unicode string given in %sarray_product_error.php on line %d
NULL
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/standard/tests/array/array_product_variation2.phpt b/ext/standard/tests/array/array_product_variation2.phpt
index 94a54505e2..c4c47d86a2 100644
--- a/ext/standard/tests/array/array_product_variation2.phpt
+++ b/ext/standard/tests/array/array_product_variation2.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test array_product() function : variation - using a keyed array
+Test array_product() function : variation
--FILE--
<?php
/* Prototype : mixed array_product(array input)
@@ -10,13 +10,13 @@ Test array_product() function : variation - using a keyed array
echo "*** Testing array_product() : variations ***\n";
-echo "\n-- Testing array_product() function with a keyed array --\n";
+echo "\n-- Testing array_product() function with a keyed array array --\n";
var_dump( array_product(array("bob" => 2, "janet" => 5)) );
?>
===DONE===
--EXPECTF--
*** Testing array_product() : variations ***
--- Testing array_product() function with a keyed array --
+-- Testing array_product() function with a keyed array array --
int(10)
===DONE===
diff --git a/ext/standard/tests/array/array_product_variation3.phpt b/ext/standard/tests/array/array_product_variation3.phpt
index 87b7be756a..dc8609ebd8 100644
--- a/ext/standard/tests/array/array_product_variation3.phpt
+++ b/ext/standard/tests/array/array_product_variation3.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test array_product() function : variation - negative numbers
+Test array_product() function : variation
--FILE--
<?php
/* Prototype : mixed array_product(array input)
diff --git a/ext/standard/tests/array/array_product_variation4.phpt b/ext/standard/tests/array/array_product_variation4.phpt
index a018611d3e..9f83c5646b 100644
--- a/ext/standard/tests/array/array_product_variation4.phpt
+++ b/ext/standard/tests/array/array_product_variation4.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test array_product() function : variation - testing with a very large array
+Test array_product() function : variation
--FILE--
<?php
/* Prototype : mixed array_product(array input)
diff --git a/ext/standard/tests/array/array_product_variation5.phpt b/ext/standard/tests/array/array_product_variation5.phpt
index 33e7997d0a..ddbb2ee704 100644
--- a/ext/standard/tests/array/array_product_variation5.phpt
+++ b/ext/standard/tests/array/array_product_variation5.phpt
@@ -220,4 +220,4 @@ NULL
Warning: array_product() expects parameter 1 to be array, null given in %sarray_product_variation5.php on line %d
NULL
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/standard/tests/array/array_rand_variation4.phpt b/ext/standard/tests/array/array_rand_variation4.phpt
index e0eddbb5ac..2bf7e9c09f 100644
--- a/ext/standard/tests/array/array_rand_variation4.phpt
+++ b/ext/standard/tests/array/array_rand_variation4.phpt
@@ -38,7 +38,7 @@ $asso_arrays = array(
// array with special chars as keys
/*6*/ array('##' => "key1", '&$r' => 'key2', '!' => "key3", '<>' =>'key4',
- "NULL" => 'key5', "\n" => 'newline as key',
+ "NULL" => 'key5',
"\t" => "tab as key", "'" => 'single quote as key',
'"' => 'double quote as key', "\0" => "null char as key")
);
diff --git a/ext/standard/tests/array/array_reduce_error.phpt b/ext/standard/tests/array/array_reduce_error.phpt
new file mode 100644
index 0000000000..954aa43d76
--- /dev/null
+++ b/ext/standard/tests/array/array_reduce_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test array_reduce() function : error conditions
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_reduce_variation1.phpt b/ext/standard/tests/array/array_reduce_variation1.phpt
new file mode 100644
index 0000000000..b02a82a7ca
--- /dev/null
+++ b/ext/standard/tests/array/array_reduce_variation1.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test array_reduce() function : variation
+--FILE--
+<?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
diff --git a/ext/standard/tests/array/array_reduce_variation2.phpt b/ext/standard/tests/array/array_reduce_variation2.phpt
new file mode 100644
index 0000000000..d68372f827
--- /dev/null
+++ b/ext/standard/tests/array/array_reduce_variation2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test array_reduce() function : variation - invalid parameters
+--FILE--
+<?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, Unicode string given in %sarray_reduce_variation2.php on line %d
+NULL
+
+Warning: array_reduce() expects parameter 1 to be array, object given in %sarray_reduce_variation2.php on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/array_reduce_variation3.phpt b/ext/standard/tests/array/array_reduce_variation3.phpt
new file mode 100644
index 0000000000..f6301026b3
--- /dev/null
+++ b/ext/standard/tests/array/array_reduce_variation3.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test array_reduce() function : variation - object callbacks
+--FILE--
+<?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
diff --git a/ext/standard/tests/array/array_slice_variation1.phpt b/ext/standard/tests/array/array_slice_variation1.phpt
index 01fcc0bc07..f3c93265ed 100644
--- a/ext/standard/tests/array/array_slice_variation1.phpt
+++ b/ext/standard/tests/array/array_slice_variation1.phpt
@@ -1,61 +1,227 @@
--TEST--
-Test array_slice() - Third parameter (NULL vs 0)
+Test array_slice() function : usage variations - Pass different data types as $input arg
--FILE--
<?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";
?>
---EXPECT--
-array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
-}
-array(0) {
-}
-array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
-}
-array(0) {
-}
-array(0) {
-}
-array(0) {
-}
-array(1) {
- [0]=>
- int(3)
-}
-array(1) {
- [2]=>
- int(3)
-}
-array(0) {
-}
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_slice() expects parameter 1 to be array, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_slice() expects parameter 1 to be array, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 18 --
array(0) {
}
-unicode(3) "foo"
+
+-- Iteration 19 --
+
+Warning: array_slice() expects parameter 1 to be array, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_slice() expects parameter 1 to be array, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_slice() expects parameter 1 to be array, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_slice() expects parameter 1 to be array, object given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: array_slice() expects parameter 1 to be array, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_udiff_assoc_error.phpt b/ext/standard/tests/array/array_udiff_assoc_error.phpt
new file mode 100644
index 0000000000..ec1cc062ed
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_assoc_error.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test array_udiff_assoc() function : error conditions
+--FILE--
+<?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
diff --git a/ext/standard/tests/array/array_udiff_assoc_variation.phpt b/ext/standard/tests/array/array_udiff_assoc_variation.phpt
new file mode 100644
index 0000000000..0c36a8e6f5
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_assoc_variation.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test array_udiff_assoc() function : variation
+--FILE--
+<?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]=>
+ unicode(4) "four"
+ [u"0.5"]=>
+ int(5)
+}
+===DONE===
diff --git a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt
new file mode 100644
index 0000000000..9886d73baa
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test array_udiff_assoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt
new file mode 100644
index 0000000000..18484a7ad2
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test array_udiff_assoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_assoc_variation3.phpt b/ext/standard/tests/array/array_udiff_assoc_variation3.phpt
new file mode 100644
index 0000000000..e693afff87
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_assoc_variation3.phpt
@@ -0,0 +1,251 @@
+--TEST--
+Test array_udiff_assoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_assoc_variation4.phpt b/ext/standard/tests/array/array_udiff_assoc_variation4.phpt
new file mode 100644
index 0000000000..0bf3e2dbbe
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_assoc_variation4.phpt
@@ -0,0 +1,228 @@
+--TEST--
+Test array_udiff_assoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_assoc_variation5.phpt b/ext/standard/tests/array/array_udiff_assoc_variation5.phpt
new file mode 100644
index 0000000000..69380767bb
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_assoc_variation5.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test array_udiff_assoc() function : usage variation - incorrect comparison functions
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_error.phpt b/ext/standard/tests/array/array_udiff_error.phpt
new file mode 100644
index 0000000000..dc9657756e
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_error.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test array_udiff() function : error conditions
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_uassoc_error.phpt b/ext/standard/tests/array/array_udiff_uassoc_error.phpt
new file mode 100644
index 0000000000..e7d27e65db
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_uassoc_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test array_udiff_uassoc() function : error conditions
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt
new file mode 100644
index 0000000000..a48d56d4da
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt
@@ -0,0 +1,228 @@
+--TEST--
+Test array_udiff_uassoc() function : usage variation
+--FILE--
+<?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
diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt
new file mode 100644
index 0000000000..c205da73f2
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt
@@ -0,0 +1,228 @@
+--TEST--
+Test array_udiff_uassoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation3.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation3.phpt
new file mode 100644
index 0000000000..76afda098b
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_uassoc_variation3.phpt
@@ -0,0 +1,254 @@
+--TEST--
+Test array_udiff_uassoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation4.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation4.phpt
new file mode 100644
index 0000000000..0beb15ff77
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_uassoc_variation4.phpt
@@ -0,0 +1,254 @@
+--TEST--
+Test array_udiff_uassoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt
new file mode 100644
index 0000000000..87c7071856
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt
@@ -0,0 +1,229 @@
+--TEST--
+Test array_udiff_uassoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt
new file mode 100644
index 0000000000..ec752a31bb
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test array_udiff_uassoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_variation1.phpt b/ext/standard/tests/array/array_udiff_variation1.phpt
new file mode 100644
index 0000000000..d2c0e24099
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_variation1.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test array_udiff() function : usage variation
+--FILE--
+<?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
diff --git a/ext/standard/tests/array/array_udiff_variation2.phpt b/ext/standard/tests/array/array_udiff_variation2.phpt
new file mode 100644
index 0000000000..fd2c12d8ac
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_variation2.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test array_udiff() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_variation3.phpt b/ext/standard/tests/array/array_udiff_variation3.phpt
new file mode 100644
index 0000000000..aeeee89bf1
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_variation3.phpt
@@ -0,0 +1,251 @@
+--TEST--
+Test array_udiff() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_variation4.phpt b/ext/standard/tests/array/array_udiff_variation4.phpt
new file mode 100644
index 0000000000..09dec4f9ec
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_variation4.phpt
@@ -0,0 +1,228 @@
+--TEST--
+Test array_udiff() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_udiff_variation5.phpt b/ext/standard/tests/array/array_udiff_variation5.phpt
new file mode 100644
index 0000000000..49405d40be
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_variation5.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test array_udiff() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt b/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt
new file mode 100644
index 0000000000..561a60dd97
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test array_uintersect_assoc() function : basic functionality - testing with multiple array arguments
+--FILE--
+<?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) {
+ [u"one"]=>
+ unicode(3) "one"
+ [3]=>
+ unicode(5) "three"
+}
+===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_assoc_error.phpt b/ext/standard/tests/array/array_uintersect_assoc_error.phpt
new file mode 100644
index 0000000000..73fc61e397
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_assoc_error.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test array_uintersect_assoc() function : error conditions
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt
new file mode 100644
index 0000000000..45d0a8da7c
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test array_uintersect_assoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt
new file mode 100644
index 0000000000..a421c252ad
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test array_uintersect_assoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation3.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation3.phpt
new file mode 100644
index 0000000000..a76fca0f5c
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_assoc_variation3.phpt
@@ -0,0 +1,251 @@
+--TEST--
+Test array_uintersect_assoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt
new file mode 100644
index 0000000000..abff23ad50
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt
@@ -0,0 +1,228 @@
+--TEST--
+Test array_uintersect_assoc() function : usage variation
+--FILE--
+<?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
diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt
new file mode 100644
index 0000000000..e2d7bd03a6
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test array_uintersect_assoc() function : usage variation - differing comparison functions
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_error.phpt b/ext/standard/tests/array/array_uintersect_error.phpt
new file mode 100644
index 0000000000..1b25db4345
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_error.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test array_uintersect() function : error conditions
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_error.phpt b/ext/standard/tests/array/array_uintersect_uassoc_error.phpt
new file mode 100644
index 0000000000..c7391eeda9
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_uassoc_error.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test array_uintersect_uassoc() function : error conditions
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt
new file mode 100644
index 0000000000..764c584b2e
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt
@@ -0,0 +1,228 @@
+--TEST--
+Test array_uintersect_uassoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt
new file mode 100644
index 0000000000..2efa93d0cb
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt
@@ -0,0 +1,228 @@
+--TEST--
+Test array_uintersect_uassoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation3.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation3.phpt
new file mode 100644
index 0000000000..860a1661a6
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_uassoc_variation3.phpt
@@ -0,0 +1,254 @@
+--TEST--
+Test array_uintersect_uassoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation4.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation4.phpt
new file mode 100644
index 0000000000..a3963184c3
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_uassoc_variation4.phpt
@@ -0,0 +1,254 @@
+--TEST--
+Test array_uintersect_uassoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt
new file mode 100644
index 0000000000..061ac60ed8
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt
@@ -0,0 +1,229 @@
+--TEST--
+Test array_uintersect_uassoc() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt
new file mode 100644
index 0000000000..6ed86f8417
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test array_uintersect_uassoc() function : usage variation - incorrect callbacks
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_variation1.phpt b/ext/standard/tests/array/array_uintersect_variation1.phpt
new file mode 100644
index 0000000000..0663a958f1
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_variation1.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test array_uintersect() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_variation2.phpt b/ext/standard/tests/array/array_uintersect_variation2.phpt
new file mode 100644
index 0000000000..79f4cd09c8
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_variation2.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test array_uintersect() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_variation3.phpt b/ext/standard/tests/array/array_uintersect_variation3.phpt
new file mode 100644
index 0000000000..707ba113c8
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_variation3.phpt
@@ -0,0 +1,251 @@
+--TEST--
+Test array_uintersect() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_variation4.phpt b/ext/standard/tests/array/array_uintersect_variation4.phpt
new file mode 100644
index 0000000000..45207b3c12
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_variation4.phpt
@@ -0,0 +1,228 @@
+--TEST--
+Test array_uintersect() function : usage variation
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_uintersect_variation5.phpt b/ext/standard/tests/array/array_uintersect_variation5.phpt
new file mode 100644
index 0000000000..75cf08e270
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_variation5.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test array_uintersect() function : usage variation - differing comparison functions
+--FILE--
+<?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===
diff --git a/ext/standard/tests/array/array_unshift_variation1.phpt b/ext/standard/tests/array/array_unshift_variation1.phpt
index 7fc6ec82e0..998d6b99d8 100644
--- a/ext/standard/tests/array/array_unshift_variation1.phpt
+++ b/ext/standard/tests/array/array_unshift_variation1.phpt
@@ -330,9 +330,9 @@ NULL
-- Iteration 24 --
Warning: array_unshift() expects parameter 1 to be array, resource given in %s on line %d
NULL
-resource(5) of type (stream)
+resource(%d) of type (stream)
Warning: array_unshift() expects parameter 1 to be array, resource given in %s on line %d
NULL
-resource(5) of type (stream)
+resource(%d) of type (stream)
Done
diff --git a/ext/standard/tests/array/array_values_error.phpt b/ext/standard/tests/array/array_values_error.phpt
new file mode 100644
index 0000000000..07d682c9e1
--- /dev/null
+++ b/ext/standard/tests/array/array_values_error.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test array_values() function : error conditions - Pass incorrect number of functions
+--FILE--
+<?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
+
diff --git a/ext/standard/tests/array/array_values_variation7.phpt b/ext/standard/tests/array/array_values_variation7.phpt
index 01d549672c..72405acf0d 100644
--- a/ext/standard/tests/array/array_values_variation7.phpt
+++ b/ext/standard/tests/array/array_values_variation7.phpt
@@ -26,7 +26,7 @@ var_dump(array_values($input));
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing array_values() : usage variations ***
-- $input argument: --
@@ -52,4 +52,4 @@ array(4) {
[3]=>
unicode(4) "zero"
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_basic.phpt b/ext/standard/tests/array/arsort_basic.phpt
new file mode 100644
index 0000000000..ad1e003cf5
--- /dev/null
+++ b/ext/standard/tests/array/arsort_basic.phpt
@@ -0,0 +1,133 @@
+--TEST--
+Test arsort() function : basic functionality
+--FILE--
+<?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) {
+ [u"o"]=>
+ unicode(6) "orange"
+ [u"l"]=>
+ unicode(5) "lemon"
+ [u"b"]=>
+ unicode(6) "banana"
+}
+
+-- Testing arsort() by supplying numeric array, 'flag' value is default --
+bool(true)
+array(4) {
+ [3]=>
+ int(555)
+ [1]=>
+ int(100)
+ [2]=>
+ int(33)
+ [4]=>
+ int(22)
+}
+
+-- Testing arsort() by supplying string array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ [u"o"]=>
+ unicode(6) "orange"
+ [u"l"]=>
+ unicode(5) "lemon"
+ [u"b"]=>
+ unicode(6) "banana"
+}
+
+-- Testing arsort() by supplying numeric array, 'flag' = SORT_REGULAR --
+bool(true)
+array(4) {
+ [3]=>
+ int(555)
+ [1]=>
+ int(100)
+ [2]=>
+ int(33)
+ [4]=>
+ int(22)
+}
+
+-- Testing arsort() by supplying string array, 'flag' = SORT_STRING --
+bool(true)
+array(3) {
+ [u"o"]=>
+ unicode(6) "orange"
+ [u"l"]=>
+ unicode(5) "lemon"
+ [u"b"]=>
+ unicode(6) "banana"
+}
+
+-- Testing arsort() by supplying numeric array, 'flag' = SORT_NUMERIC --
+bool(true)
+array(4) {
+ [3]=>
+ int(555)
+ [1]=>
+ int(100)
+ [2]=>
+ int(33)
+ [4]=>
+ int(22)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_object1.phpt b/ext/standard/tests/array/arsort_object1.phpt
new file mode 100644
index 0000000000..6dca4954dc
--- /dev/null
+++ b/ext/standard/tests/array/arsort_object1.phpt
@@ -0,0 +1,90 @@
+--TEST--
+Test arsort() function : object functionality - sort objects
+--FILE--
+<?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 __tounicode() {
+ return (string)$this->value;
+ }
+
+}
+
+// array of integer objects
+$unsorted_int_obj = array (
+ 1 => new for_integer_arsort(11), 2 => new for_integer_asort(66),
+ 3 => new for_integer_arsort(23), 4 => new for_integer_asort(-5),
+ 5 => new for_integer_arsort(0.001), 6 => new for_integer_asort(0)
+);
+
+// array of string objects
+$unsorted_str_obj = array (
+ "a" => new for_string_arsort("axx"), "b" => new for_string_asort("t"),
+ "c" => new for_string_arsort("w"), "d" => new for_string_asort("py"),
+ "e" => new for_string_arsort("apple"), "f" => new for_string_asort("Orange"),
+ "g" => new for_string_arsort("Lemon"), "h" => new for_string_asort("aPPle")
+);
+
+
+echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is defualt --\n";
+
+// testing arsort() function by supplying integer object array, flag value is defualt
+$temp_array = $unsorted_int_obj;
+var_dump(arsort($temp_array) );
+var_dump($temp_array);
+
+// testing arsort() function by supplying string object array, flag value is defualt
+$temp_array = $unsorted_str_obj;
+var_dump(arsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n";
+// testing arsort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(arsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing arsort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(arsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : object functionality ***
+
+Fatal error: Class 'for_integer_asort' not found in %sarsort_object1.php on line %d \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_object2.phpt b/ext/standard/tests/array/arsort_object2.phpt
new file mode 100644
index 0000000000..215e59d9e1
--- /dev/null
+++ b/ext/standard/tests/array/arsort_object2.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test arsort() function : object functionality - sorting objects with diff. accessibility of member vars
+--FILE--
+<?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 __tounicode() {
+ return (string)$this->value;
+ }
+}
+
+// array of integer objects
+$unsorted_int_obj = array (
+ 1 => new for_integer_arsort(11, 33,2), 2 => new for_integer_asort(44, 66,3),
+ 3 => new for_integer_arsort(23, 32,6), 4 => new for_integer_asort(-88, -5,-4),
+);
+
+// array of string objects
+$unsorted_str_obj = array (
+ "a" => new for_string_arsort("axx","AXX","d"), "b" => new for_string_asort("T", "t","q"),
+ "c" => new for_string_arsort("w", "W","c"), "d" => new for_string_asort("PY", "py","s"),
+);
+
+
+echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is default --\n";
+
+// testing arsort() function by supplying integer object array, flag value is default
+$temp_array = $unsorted_int_obj;
+var_dump(arsort($temp_array) );
+var_dump($temp_array);
+
+// testing arsort() function by supplying string object array, flag value is default
+$temp_array = $unsorted_str_obj;
+var_dump(arsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n";
+// testing arsort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(arsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing arsort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(arsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : object functionality ***
+
+Fatal error: Class 'for_integer_asort' not found in %sarsort_object2.php on line %d \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation3.phpt b/ext/standard/tests/array/arsort_variation3.phpt
index dab0ee5159..0ceba736ae 100644
--- a/ext/standard/tests/array/arsort_variation3.phpt
+++ b/ext/standard/tests/array/arsort_variation3.phpt
@@ -10,7 +10,7 @@ Test arsort() function : usage variations - sort integer/float values
/*
* Testing arsort() by providing different integer/float value arrays for $array argument with following values
- * 1. flag value as default
+ * 1. flag value as defualt
* 2. SORT_REGULAR - compare items normally
* 3. SORT_NUMERIC - compare items numerically
*/
@@ -59,7 +59,7 @@ foreach ($various_arrays as $array) {
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing arsort() : usage variations ***
-- Testing arsort() by supplying various integer/float arrays --
@@ -273,7 +273,7 @@ array(11) {
bool(true)
array(7) {
[2]=>
- %s(2147483648)
+ float(2147483648)
[1]=>
int(2147483647)
[6]=>
@@ -283,15 +283,15 @@ array(7) {
[3]=>
int(-2147483647)
[4]=>
- %s(-2147483648)
+ float(-2147483648)
[7]=>
- %s(-2147483649)
+ float(-2147483649)
}
- Sort_flag = SORT_REGULAR -
bool(true)
array(7) {
[2]=>
- %s(2147483648)
+ float(2147483648)
[1]=>
int(2147483647)
[6]=>
@@ -301,15 +301,15 @@ array(7) {
[3]=>
int(-2147483647)
[4]=>
- %s(-2147483648)
+ float(-2147483648)
[7]=>
- %s(-2147483649)
+ float(-2147483649)
}
- Sort_flag = SORT_NUMERIC -
bool(true)
array(7) {
[2]=>
- %s(2147483648)
+ float(2147483648)
[1]=>
int(2147483647)
[6]=>
@@ -319,8 +319,8 @@ array(7) {
[3]=>
int(-2147483647)
[4]=>
- %s(-2147483648)
+ float(-2147483648)
[7]=>
- %s(-2147483649)
+ float(-2147483649)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/bug44181.phpt b/ext/standard/tests/array/bug44181.phpt
new file mode 100644
index 0000000000..f773bbf2aa
--- /dev/null
+++ b/ext/standard/tests/array/bug44181.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #44181 (extract EXTR_OVERWRITE|EXTR_REFS can fail to create references)
+--FILE--
+<?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--
+unicode(%d) "changed.foo"
+Done
diff --git a/ext/standard/tests/array/bug44182.phpt b/ext/standard/tests/array/bug44182.phpt
new file mode 100644
index 0000000000..076b409f58
--- /dev/null
+++ b/ext/standard/tests/array/bug44182.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #44182 (extract EXTR_REFS can fail to split copy-on-write references)
+--FILE--
+<?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--
+unicode(%d) "original.foo"
+Done
+
diff --git a/ext/standard/tests/array/compact_variation1.phpt b/ext/standard/tests/array/compact_variation1.phpt
index 712ea738fd..c41126e732 100644
--- a/ext/standard/tests/array/compact_variation1.phpt
+++ b/ext/standard/tests/array/compact_variation1.phpt
@@ -34,6 +34,33 @@ echo "Done";
Warning: compact(): recursion detected in %s on line %d
array(1) {
+ ["a"]=>
+ int(1)
+}
+
+Warning: compact(): recursion detected in %s on line %d
+
+Warning: compact(): recursion detected in %s on line %d
+
+Warning: compact(): recursion detected in %s on line %d
+
+Warning: compact(): recursion detected in %s on line %d
+array(2) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+}
+array(1) {
+ ["c"]=>
+ int(3)
+}
+Done
+--UEXPECTF--
+*** Testing compact() : usage variations - arrays containg references ***
+
+Warning: compact(): recursion detected in %s on line %d
+array(1) {
[u"a"]=>
int(1)
}
@@ -55,4 +82,4 @@ array(1) {
[u"c"]=>
int(3)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/compact_variation2.phpt b/ext/standard/tests/array/compact_variation2.phpt
new file mode 100644
index 0000000000..66b6bdbf76
--- /dev/null
+++ b/ext/standard/tests/array/compact_variation2.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test compact() function: ensure compact() doesn't pick up variables declared outside of current scope.
+--FILE--
+<?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) {
+ [u"b"]=>
+ unicode(3) "f.b"
+ [u"c"]=>
+ unicode(3) "f.c"
+}
+array(2) {
+ [u"b"]=>
+ unicode(3) "f.b"
+ [u"c"]=>
+ unicode(3) "f.c"
+}
+==Done== \ No newline at end of file
diff --git a/ext/standard/tests/array/compare_function.inc b/ext/standard/tests/array/compare_function.inc
new file mode 100644
index 0000000000..e5176802ab
--- /dev/null
+++ b/ext/standard/tests/array/compare_function.inc
@@ -0,0 +1,13 @@
+<?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
diff --git a/ext/standard/tests/array/current_basic.phpt b/ext/standard/tests/array/current_basic.phpt
index adfe7da053..3ef4740392 100644
--- a/ext/standard/tests/array/current_basic.phpt
+++ b/ext/standard/tests/array/current_basic.phpt
@@ -23,7 +23,7 @@ next($array);
var_dump(current($array));
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing current() : basic functionality ***
unicode(4) "zero"
unicode(3) "one"
diff --git a/ext/standard/tests/array/current_variation1.phpt b/ext/standard/tests/array/current_variation1.phpt
index 24accd4a6f..8acbcf3c85 100644
--- a/ext/standard/tests/array/current_variation1.phpt
+++ b/ext/standard/tests/array/current_variation1.phpt
@@ -198,8 +198,6 @@ Warning: current() expects parameter 1 to be array, Unicode string given in %s o
NULL
-- Iteration 21 --
-
-Warning: current() expects parameter 1 to be array, object given in %s on line %d
NULL
-- Iteration 22 --
@@ -217,3 +215,4 @@ NULL
Warning: current() expects parameter 1 to be array, resource given in %s on line %d
NULL
===DONE===
+
diff --git a/ext/standard/tests/array/current_variation3.phpt b/ext/standard/tests/array/current_variation3.phpt
index 1cfd802a56..8c28be4cd7 100644
--- a/ext/standard/tests/array/current_variation3.phpt
+++ b/ext/standard/tests/array/current_variation3.phpt
@@ -30,7 +30,7 @@ echo "\$array2: ";
var_dump(current($array2));
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing current() : usage variations ***
-- Initial position of internal pointer --
diff --git a/ext/standard/tests/array/current_variation4.phpt b/ext/standard/tests/array/current_variation4.phpt
index 5f42fa45de..e1260f11f3 100644
--- a/ext/standard/tests/array/current_variation4.phpt
+++ b/ext/standard/tests/array/current_variation4.phpt
@@ -46,7 +46,7 @@ var_dump(current($multi_array[3][3][3]));
var_dump(current($multi_array[3][3][3][1]));
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing current() : usage variations ***
-- Two Dimensional Array --
diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt
index e9c05d5077..58a552f094 100644
--- a/ext/standard/tests/array/each_basic.phpt
+++ b/ext/standard/tests/array/each_basic.phpt
@@ -30,7 +30,7 @@ var_dump(each($arr));
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing each() : basic functionality ***
-- Passed array: --
@@ -71,4 +71,4 @@ array(4) {
-- Passed the end of array: --
bool(false)
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each_error.phpt b/ext/standard/tests/array/each_error.phpt
index 489681a5fa..0806bee674 100644
--- a/ext/standard/tests/array/each_error.phpt
+++ b/ext/standard/tests/array/each_error.phpt
@@ -40,3 +40,4 @@ NULL
Warning: each() expects exactly 1 parameter, 2 given in %s on line %d
NULL
Done
+
diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt
index fbb5feebfe..eb12212e3d 100644
--- a/ext/standard/tests/array/each_variation2.phpt
+++ b/ext/standard/tests/array/each_variation2.phpt
@@ -245,4 +245,4 @@ array(4) {
[u"key"]=>
int(0)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt
index ff1791aa71..0333c8880f 100644
--- a/ext/standard/tests/array/each_variation3.phpt
+++ b/ext/standard/tests/array/each_variation3.phpt
@@ -104,7 +104,7 @@ foreach($inputs as $key => $input) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing each() : usage variations ***
-- Iteration 1: int data --
@@ -250,4 +250,4 @@ array(4) {
[u"key"]=>
unicode(0) ""
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt
index 765159441b..f05a7c9aed 100644
--- a/ext/standard/tests/array/each_variation4.phpt
+++ b/ext/standard/tests/array/each_variation4.phpt
@@ -86,4 +86,4 @@ array(3) {
[2]=>
unicode(3) "two"
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each_variation5.phpt b/ext/standard/tests/array/each_variation5.phpt
index 09bf3f4f6d..495927494b 100644
--- a/ext/standard/tests/array/each_variation5.phpt
+++ b/ext/standard/tests/array/each_variation5.phpt
@@ -33,7 +33,7 @@ var_dump( each($arr[2]));
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing each() : usage variations ***
-- Pass each() a two-dimensional array --
@@ -93,4 +93,4 @@ array(4) {
[u"key"]=>
int(0)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt
index 5fa5460188..e2b49a5728 100644
--- a/ext/standard/tests/array/each_variation6.phpt
+++ b/ext/standard/tests/array/each_variation6.phpt
@@ -28,7 +28,7 @@ echo key($arr) . " => " . current($arr) . "\n";
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing each() : usage variations ***
-- Current position: --
@@ -48,4 +48,4 @@ array(4) {
-- New position: --
1 => one
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/end_basic.phpt b/ext/standard/tests/array/end_basic.phpt
index 56f037ab2f..d384f7d2ae 100644
--- a/ext/standard/tests/array/end_basic.phpt
+++ b/ext/standard/tests/array/end_basic.phpt
@@ -29,7 +29,7 @@ $array[2] = 'foo';
var_dump(end($array));
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing end() : basic functionality ***
-- Initial Position: --
diff --git a/ext/standard/tests/array/end_variation1.phpt b/ext/standard/tests/array/end_variation1.phpt
index 5ad896109f..8676a71da5 100644
--- a/ext/standard/tests/array/end_variation1.phpt
+++ b/ext/standard/tests/array/end_variation1.phpt
@@ -201,9 +201,7 @@ Warning: end() expects parameter 1 to be array, Unicode string given in %s on li
NULL
-- Iteration 22 --
-
-Warning: end() expects parameter 1 to be array, object given in %s on line %d
-NULL
+unicode(12) "hello, world"
-- Iteration 23 --
@@ -220,3 +218,4 @@ NULL
Warning: end() expects parameter 1 to be array, resource given in %s on line %d
NULL
===DONE===
+
diff --git a/ext/standard/tests/array/end_variation2.phpt b/ext/standard/tests/array/end_variation2.phpt
index ea9c336ac0..180f7cdfbd 100644
--- a/ext/standard/tests/array/end_variation2.phpt
+++ b/ext/standard/tests/array/end_variation2.phpt
@@ -25,7 +25,7 @@ echo "\n-- Pass a sub-array as \$array_arg --\n";
var_dump(end($array_arg[0]));
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing end() : usage variations ***
-- Pass a two-dimensional array as $array_arg --
diff --git a/ext/standard/tests/array/end_variation3.phpt b/ext/standard/tests/array/end_variation3.phpt
index 0a83342949..1a28ec9901 100644
--- a/ext/standard/tests/array/end_variation3.phpt
+++ b/ext/standard/tests/array/end_variation3.phpt
@@ -29,7 +29,7 @@ echo "\$array2: ";
var_dump(current($array2));
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing end() : usage variations ***
-- Initial position of internal pointer --
diff --git a/ext/standard/tests/array/key_basic.phpt b/ext/standard/tests/array/key_basic.phpt
index 0b4377ef52..f25e60d931 100644
--- a/ext/standard/tests/array/key_basic.phpt
+++ b/ext/standard/tests/array/key_basic.phpt
@@ -30,7 +30,7 @@ next($array);
var_dump(key($array));
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing key() : basic functionality ***
-- Initial Position: --
diff --git a/ext/standard/tests/array/key_variation1.phpt b/ext/standard/tests/array/key_variation1.phpt
index 93d0ebc714..2dd87dd45a 100644
--- a/ext/standard/tests/array/key_variation1.phpt
+++ b/ext/standard/tests/array/key_variation1.phpt
@@ -201,9 +201,7 @@ Warning: key() expects parameter 1 to be array, Unicode string given in %s on li
NULL
-- Iteration 22 --
-
-Warning: key() expects parameter 1 to be array, object given in %s on line %d
-NULL
+unicode(4) "var1"
-- Iteration 23 --
@@ -220,3 +218,4 @@ NULL
Warning: key() expects parameter 1 to be array, resource given in %s on line %d
NULL
===DONE===
+
diff --git a/ext/standard/tests/array/key_variation2.phpt b/ext/standard/tests/array/key_variation2.phpt
index 6a463b9fdf..3d3401d751 100644
--- a/ext/standard/tests/array/key_variation2.phpt
+++ b/ext/standard/tests/array/key_variation2.phpt
@@ -104,7 +104,7 @@ foreach($inputs as $key => $input) {
};
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing key() : usage variations ***
-- Iteration 1 : int data --
diff --git a/ext/standard/tests/array/key_variation3.phpt b/ext/standard/tests/array/key_variation3.phpt
index 916e99af38..a231917814 100644
--- a/ext/standard/tests/array/key_variation3.phpt
+++ b/ext/standard/tests/array/key_variation3.phpt
@@ -31,7 +31,7 @@ echo "\$array2: ";
var_dump(key($array2));
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing key() : usage variations ***
-- Initial position of internal pointer --
diff --git a/ext/standard/tests/array/key_variation4.phpt b/ext/standard/tests/array/key_variation4.phpt
index 6698d6385a..147d55aa13 100644
--- a/ext/standard/tests/array/key_variation4.phpt
+++ b/ext/standard/tests/array/key_variation4.phpt
@@ -45,7 +45,7 @@ var_dump(key($multi_array[3][3][3]));
var_dump(key($multi_array[3][3][3][1]));
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing key() : usage variations ***
-- Two Dimensional Array --
diff --git a/ext/standard/tests/array/natcasesort_basic.phpt b/ext/standard/tests/array/natcasesort_basic.phpt
index 06dfb6c277..4a9c5b5f97 100644
--- a/ext/standard/tests/array/natcasesort_basic.phpt
+++ b/ext/standard/tests/array/natcasesort_basic.phpt
@@ -23,7 +23,7 @@ var_dump($array);
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing natcasesort() : basic functionality ***
-- Before sorting: --
@@ -54,4 +54,4 @@ array(5) {
[2]=>
unicode(3) "b10"
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_error.phpt b/ext/standard/tests/array/natcasesort_error.phpt
index 377a407d72..9ae8691e1e 100644
--- a/ext/standard/tests/array/natcasesort_error.phpt
+++ b/ext/standard/tests/array/natcasesort_error.phpt
@@ -37,4 +37,4 @@ NULL
Warning: natcasesort() expects exactly 1 parameter, 2 given in %s on line %d
NULL
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation1.phpt b/ext/standard/tests/array/natcasesort_variation1.phpt
index 6c4fbec53c..918e051e6b 100644
--- a/ext/standard/tests/array/natcasesort_variation1.phpt
+++ b/ext/standard/tests/array/natcasesort_variation1.phpt
@@ -220,3 +220,4 @@ NULL
Warning: natcasesort() expects parameter 1 to be array, resource given in %s on line %d
NULL
Done
+
diff --git a/ext/standard/tests/array/natcasesort_variation10.phpt b/ext/standard/tests/array/natcasesort_variation10.phpt
index 09f69eb93d..00db813804 100644
--- a/ext/standard/tests/array/natcasesort_variation10.phpt
+++ b/ext/standard/tests/array/natcasesort_variation10.phpt
@@ -28,7 +28,7 @@ echo key($array_arg) . " => " . current ($array_arg) . "\n";
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing natcasesort() : usage variations ***
-- Initial Position of Internal Pointer: --
diff --git a/ext/standard/tests/array/natcasesort_variation11.phpt b/ext/standard/tests/array/natcasesort_variation11.phpt
index c25e6c42da..604c219935 100644
--- a/ext/standard/tests/array/natcasesort_variation11.phpt
+++ b/ext/standard/tests/array/natcasesort_variation11.phpt
@@ -112,7 +112,7 @@ foreach($inputs as $input) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing natcasesort() : usage variations ***
-- Iteration 1 --
@@ -229,4 +229,4 @@ array(3) {
[u"hello"]=>
unicode(5) "world"
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation2.phpt b/ext/standard/tests/array/natcasesort_variation2.phpt
index eb592997d4..764d8fa77e 100644
--- a/ext/standard/tests/array/natcasesort_variation2.phpt
+++ b/ext/standard/tests/array/natcasesort_variation2.phpt
@@ -224,4 +224,4 @@ array(1) {
[0]=>
resource(%d) of type (stream)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation3.phpt b/ext/standard/tests/array/natcasesort_variation3.phpt
index 08db874917..77f83e1d09 100644
--- a/ext/standard/tests/array/natcasesort_variation3.phpt
+++ b/ext/standard/tests/array/natcasesort_variation3.phpt
@@ -42,7 +42,7 @@ foreach ($inputs as $array_arg) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing natcasesort() : usage variation ***
-- Iteration 1 --
@@ -132,4 +132,4 @@ array(7) {
[1]=>
float(2147483648)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation4.phpt b/ext/standard/tests/array/natcasesort_variation4.phpt
index 8c655bd0c3..b3bb8b5a15 100644
--- a/ext/standard/tests/array/natcasesort_variation4.phpt
+++ b/ext/standard/tests/array/natcasesort_variation4.phpt
@@ -28,7 +28,7 @@ foreach ($inputs as $array_arg) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing natcasesort() : usage variation ***
bool(true)
array(11) {
@@ -84,3 +84,4 @@ array(12) {
unicode(1) "X"
}
Done
+
diff --git a/ext/standard/tests/array/natcasesort_variation5.phpt b/ext/standard/tests/array/natcasesort_variation5.phpt
index f2cbd17191..867d0b89e4 100644
--- a/ext/standard/tests/array/natcasesort_variation5.phpt
+++ b/ext/standard/tests/array/natcasesort_variation5.phpt
@@ -19,7 +19,7 @@ var_dump($unsorted_hex_array);
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing natcasesort() : usage variation ***
bool(true)
array(11) {
@@ -46,4 +46,4 @@ array(11) {
[1]=>
int(4095)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation6.phpt b/ext/standard/tests/array/natcasesort_variation6.phpt
index bbbefa799e..1d151d80d3 100644
--- a/ext/standard/tests/array/natcasesort_variation6.phpt
+++ b/ext/standard/tests/array/natcasesort_variation6.phpt
@@ -29,7 +29,7 @@ var_dump($array);
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing natcasesort() : usage variation ***
-- Initial test --
@@ -53,4 +53,4 @@ array(3) {
[2]=>
&int(555)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation7.phpt b/ext/standard/tests/array/natcasesort_variation7.phpt
index f4c70702de..e53e34ced1 100644
--- a/ext/standard/tests/array/natcasesort_variation7.phpt
+++ b/ext/standard/tests/array/natcasesort_variation7.phpt
@@ -22,7 +22,7 @@ var_dump($array);
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing natcasesort() : usage variations ***
array(5) {
[0]=>
@@ -93,4 +93,4 @@ array(5) {
[2]=>
unicode(4) "zero"
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation8.phpt b/ext/standard/tests/array/natcasesort_variation8.phpt
index b0f7cbba50..fbced4a229 100644
--- a/ext/standard/tests/array/natcasesort_variation8.phpt
+++ b/ext/standard/tests/array/natcasesort_variation8.phpt
@@ -20,7 +20,7 @@ var_dump($unsorted_oct_array);
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing natcasesort() : usage variation ***
bool(true)
array(9) {
@@ -43,4 +43,4 @@ array(9) {
[0]=>
int(669)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation9.phpt b/ext/standard/tests/array/natcasesort_variation9.phpt
index 156375941b..cdb02982f3 100644
--- a/ext/standard/tests/array/natcasesort_variation9.phpt
+++ b/ext/standard/tests/array/natcasesort_variation9.phpt
@@ -8,7 +8,7 @@ Test natcasesort() function : usage variations - mixed array
*/
/*
- * Pass an array containing sub-arrays, ints, floats, strings, boolean, null
+ * Pass an array containing sub-arrays, ints, floats, Unicode strings, boolean, null
* and escape characters to test how natcasesort() re-orders it
*/
@@ -107,4 +107,4 @@ array(22) {
[11]=>
unicode(4) "True"
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natsort_basic.phpt b/ext/standard/tests/array/natsort_basic.phpt
new file mode 100644
index 0000000000..e38359fe68
--- /dev/null
+++ b/ext/standard/tests/array/natsort_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test natsort(): basic functionality
+--FILE--
+<?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
+)
+
diff --git a/ext/standard/tests/array/next_basic.phpt b/ext/standard/tests/array/next_basic.phpt
index 358e396e5f..c0e7accf0d 100644
--- a/ext/standard/tests/array/next_basic.phpt
+++ b/ext/standard/tests/array/next_basic.phpt
@@ -24,7 +24,7 @@ echo key($array) . " => " . current($array) . "\n";
var_dump(next($array));
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing next() : basic functionality ***
0 => zero
unicode(3) "one"
diff --git a/ext/standard/tests/array/next_variation1.phpt b/ext/standard/tests/array/next_variation1.phpt
index 959b3b6ee0..45ed548588 100644
--- a/ext/standard/tests/array/next_variation1.phpt
+++ b/ext/standard/tests/array/next_variation1.phpt
@@ -200,9 +200,7 @@ Warning: next() expects parameter 1 to be array, Unicode string given in %s on l
NULL
-- Iteration 22 --
-
-Warning: next() expects parameter 1 to be array, object given in %s on line %d
-NULL
+bool(false)
-- Iteration 23 --
@@ -219,3 +217,4 @@ NULL
Warning: next() expects parameter 1 to be array, resource given in %s on line %d
NULL
===DONE===
+
diff --git a/ext/standard/tests/array/next_variation2.phpt b/ext/standard/tests/array/next_variation2.phpt
index 1ecde7efce..e7505096d9 100644
--- a/ext/standard/tests/array/next_variation2.phpt
+++ b/ext/standard/tests/array/next_variation2.phpt
@@ -26,7 +26,7 @@ echo "\n-- Pass a sub-array as \$array_arg --\n";
var_dump(next($array_arg[0]));
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing next() : usage variations ***
-- Pass a two-dimensional array as $array_arg --
diff --git a/ext/standard/tests/array/prev_variation1.phpt b/ext/standard/tests/array/prev_variation1.phpt
index 43b73e850b..837b2e16e6 100755
--- a/ext/standard/tests/array/prev_variation1.phpt
+++ b/ext/standard/tests/array/prev_variation1.phpt
@@ -200,9 +200,7 @@ Warning: prev() expects parameter 1 to be array, Unicode string given in %s on l
NULL
-- Iteration 22 --
-
-Warning: prev() expects parameter 1 to be array, object given in %s on line %d
-NULL
+bool(false)
-- Iteration 23 --
@@ -219,3 +217,4 @@ NULL
Warning: prev() expects parameter 1 to be array, resource given in %s on line %d
NULL
===DONE===
+
diff --git a/ext/standard/tests/array/reset_basic.phpt b/ext/standard/tests/array/reset_basic.phpt
index b18f6ff64b..e29bcb5e47 100644
--- a/ext/standard/tests/array/reset_basic.phpt
+++ b/ext/standard/tests/array/reset_basic.phpt
@@ -28,7 +28,7 @@ echo "\n-- Call to reset() --\n";
var_dump(reset($array));
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing reset() : basic functionality ***
-- Initial Position: --
diff --git a/ext/standard/tests/array/reset_variation1.phpt b/ext/standard/tests/array/reset_variation1.phpt
index 1637789eb8..4743ca6682 100644
--- a/ext/standard/tests/array/reset_variation1.phpt
+++ b/ext/standard/tests/array/reset_variation1.phpt
@@ -200,9 +200,7 @@ Warning: reset() expects parameter 1 to be array, Unicode string given in %s on
NULL
-- Iteration 22 --
-
-Warning: reset() expects parameter 1 to be array, object given in %s on line %d
-NULL
+bool(false)
-- Iteration 23 --
@@ -219,3 +217,4 @@ NULL
Warning: reset() expects parameter 1 to be array, resource given in %s on line %d
NULL
===DONE===
+
diff --git a/ext/standard/tests/array/reset_variation2.phpt b/ext/standard/tests/array/reset_variation2.phpt
index 713c88adde..43b7875a01 100644
--- a/ext/standard/tests/array/reset_variation2.phpt
+++ b/ext/standard/tests/array/reset_variation2.phpt
@@ -23,7 +23,7 @@ unset($array[0]);
var_dump(reset($array));
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing reset() : usage variations ***
-- Initial Position: --
diff --git a/ext/standard/tests/array/reset_variation3.phpt b/ext/standard/tests/array/reset_variation3.phpt
index eaccecc7bc..31e9706dcd 100644
--- a/ext/standard/tests/array/reset_variation3.phpt
+++ b/ext/standard/tests/array/reset_variation3.phpt
@@ -39,7 +39,7 @@ echo "\$array2: ";
var_dump(current($array2));
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing reset() : usage variations ***
-- Initial position of internal pointer --
diff --git a/ext/standard/tests/array/rsort_basic.phpt b/ext/standard/tests/array/rsort_basic.phpt
index 4fe4673f83..bd65c43ed3 100644
--- a/ext/standard/tests/array/rsort_basic.phpt
+++ b/ext/standard/tests/array/rsort_basic.phpt
@@ -19,12 +19,12 @@ $unsorted_strings = array( "l" => "lemon", "o" => "orange", "b" => "banana" );
// array with default keys containing unsorted numeric values
$unsorted_numerics = array( 100, 33, 555, 22 );
-echo "\n-- Testing rsort() by supplying string array, 'flag' value is default --\n";
+echo "\n-- Testing rsort() by supplying string array, 'flag' value is defualt --\n";
$temp_array = $unsorted_strings;
var_dump( rsort($temp_array) );
var_dump( $temp_array);
-echo "\n-- Testing rsort() by supplying numeric array, 'flag' value is default --\n";
+echo "\n-- Testing rsort() by supplying numeric array, 'flag' value is defualt --\n";
$temp_array = $unsorted_numerics;
var_dump( rsort($temp_array) );
var_dump( $temp_array);
@@ -52,10 +52,10 @@ var_dump( $temp_array);
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing rsort() : basic functionality ***
--- Testing rsort() by supplying string array, 'flag' value is default --
+-- Testing rsort() by supplying string array, 'flag' value is defualt --
bool(true)
array(3) {
[0]=>
@@ -66,7 +66,7 @@ array(3) {
unicode(6) "banana"
}
--- Testing rsort() by supplying numeric array, 'flag' value is default --
+-- Testing rsort() by supplying numeric array, 'flag' value is defualt --
bool(true)
array(4) {
[0]=>
@@ -126,4 +126,4 @@ array(4) {
[3]=>
int(22)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_error.phpt b/ext/standard/tests/array/rsort_error.phpt
index 47dbf4c0bf..6f6f2f9762 100644
--- a/ext/standard/tests/array/rsort_error.phpt
+++ b/ext/standard/tests/array/rsort_error.phpt
@@ -48,4 +48,4 @@ array(2) {
[1]=>
int(2)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_object1.phpt b/ext/standard/tests/array/rsort_object1.phpt
index a4999c33ca..2db9fb7d4d 100644
--- a/ext/standard/tests/array/rsort_object1.phpt
+++ b/ext/standard/tests/array/rsort_object1.phpt
@@ -34,7 +34,7 @@ class for_string_rsort
}
// return string value
- function __tostring() {
+ function __tounicode() {
return (string)$this->value;
}
@@ -58,12 +58,12 @@ $unsorted_str_obj = array (
echo "\n-- Sort flag = default --\n";
-// testing rsort() function by supplying integer object array, flag value is default
+// testing rsort() function by supplying integer object array, flag value is defualt
$temp_array = $unsorted_int_obj;
var_dump(rsort($temp_array) );
var_dump($temp_array);
-// testing rsort() function by supplying string object array, flag value is default
+// testing rsort() function by supplying string object array, flag value is defualt
$temp_array = $unsorted_str_obj;
var_dump(rsort($temp_array) );
var_dump($temp_array);
@@ -240,4 +240,4 @@ array(8) {
unicode(5) "Lemon"
}
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_object2.phpt b/ext/standard/tests/array/rsort_object2.phpt
index fc3683e0b3..8071545ecf 100644
--- a/ext/standard/tests/array/rsort_object2.phpt
+++ b/ext/standard/tests/array/rsort_object2.phpt
@@ -43,7 +43,7 @@ class for_string_rsort
}
// return string value
- function __tostring() {
+ function __tounicode() {
return (string)$this->value;
}
@@ -69,12 +69,12 @@ $unsorted_str_obj = array (
echo "\n-- Sort flag = default --\n";
-// testing rsort() function by supplying integer object array, flag value is default
+// testing rsort() function by supplying integer object array, flag value is defualt
$temp_array = $unsorted_int_obj;
var_dump(rsort($temp_array) );
var_dump($temp_array);
-// testing rsort() function by supplying string object array, flag value is default
+// testing rsort() function by supplying string object array, flag value is defualt
$temp_array = $unsorted_str_obj;
var_dump(rsort($temp_array) );
var_dump($temp_array);
@@ -255,4 +255,4 @@ array(4) {
unicode(3) "ass"
}
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation1.phpt b/ext/standard/tests/array/rsort_variation1.phpt
index 0abfde64a7..05b56e8631 100644
--- a/ext/standard/tests/array/rsort_variation1.phpt
+++ b/ext/standard/tests/array/rsort_variation1.phpt
@@ -511,4 +511,4 @@ Flag = SORT_STRING:
Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d
bool(false)
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation10.phpt b/ext/standard/tests/array/rsort_variation10.phpt
index 2e4a96adba..ccf886b070 100644
--- a/ext/standard/tests/array/rsort_variation10.phpt
+++ b/ext/standard/tests/array/rsort_variation10.phpt
@@ -34,7 +34,7 @@ var_dump($temp_array);
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing rsort() : variation ***
-- Sort flag = default --
@@ -105,4 +105,4 @@ array(9) {
[8]=>
int(-229)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation11.phpt b/ext/standard/tests/array/rsort_variation11.phpt
index 408c37bd6e..73daf1712d 100644
--- a/ext/standard/tests/array/rsort_variation11.phpt
+++ b/ext/standard/tests/array/rsort_variation11.phpt
Binary files differ
diff --git a/ext/standard/tests/array/rsort_variation2.phpt b/ext/standard/tests/array/rsort_variation2.phpt
index e546b3f619..bf99ee9d71 100644
--- a/ext/standard/tests/array/rsort_variation2.phpt
+++ b/ext/standard/tests/array/rsort_variation2.phpt
@@ -481,4 +481,4 @@ array(5) {
[4]=>
int(1)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation3.phpt b/ext/standard/tests/array/rsort_variation3.phpt
index ef1fb1085c..f8c002a6f7 100644
--- a/ext/standard/tests/array/rsort_variation3.phpt
+++ b/ext/standard/tests/array/rsort_variation3.phpt
@@ -1,5 +1,9 @@
--TEST--
Test rsort() function : usage variations - numeric values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
--FILE--
<?php
/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
@@ -38,7 +42,7 @@ $count = 1;
foreach ($various_arrays as $array) {
echo "\n-- Iteration $count --\n";
- echo "- With default sort flag -\n";
+ echo "- With Defualt sort flag -\n";
$temp_array = $array;
var_dump(rsort($temp_array) );
var_dump($temp_array);
@@ -56,11 +60,11 @@ foreach ($various_arrays as $array) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing rsort() : variation ***
-- Iteration 1 --
-- With default sort flag -
+- With Defualt sort flag -
bool(true)
array(9) {
[0]=>
@@ -128,7 +132,7 @@ array(9) {
}
-- Iteration 2 --
-- With default sort flag -
+- With Defualt sort flag -
bool(true)
array(7) {
[0]=>
@@ -184,7 +188,7 @@ array(7) {
}
-- Iteration 3 --
-- With default sort flag -
+- With Defualt sort flag -
bool(true)
array(11) {
[0]=>
@@ -264,7 +268,7 @@ array(11) {
}
-- Iteration 4 --
-- With default sort flag -
+- With Defualt sort flag -
bool(true)
array(7) {
[0]=>
@@ -318,4 +322,4 @@ array(7) {
[6]=>
float(-2147483649)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation4.phpt b/ext/standard/tests/array/rsort_variation4.phpt
index 1eac39eeff..5e64a4e895 100644
--- a/ext/standard/tests/array/rsort_variation4.phpt
+++ b/ext/standard/tests/array/rsort_variation4.phpt
@@ -23,7 +23,7 @@ $value3 = 555;
// an array containing integer references
$unsorted_numerics = array( &$value1 , &$value2, &$value3);
-echo "\n-- 'flag' value is default --\n";
+echo "\n-- 'flag' value is defualt --\n";
$temp_array = $unsorted_numerics;
var_dump( rsort($temp_array) );
var_dump( $temp_array);
@@ -44,7 +44,7 @@ echo "Done";
Deprecated: Call-time pass-by-reference has been deprecated in %s on line %d
*** Testing rsort() : variation ***
--- 'flag' value is default --
+-- 'flag' value is defualt --
bool(true)
array(3) {
[0]=>
@@ -76,4 +76,4 @@ array(3) {
[2]=>
&int(33)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation5.phpt b/ext/standard/tests/array/rsort_variation5.phpt
index b74037fc8c..ebd45f4793 100644
--- a/ext/standard/tests/array/rsort_variation5.phpt
+++ b/ext/standard/tests/array/rsort_variation5.phpt
@@ -47,7 +47,7 @@ foreach ($various_arrays as $array) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing rsort() : variation ***
-- Iteration 1 --
@@ -218,4 +218,4 @@ array(12) {
[11]=>
unicode(6) "BANANA"
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation6.phpt b/ext/standard/tests/array/rsort_variation6.phpt
index 4c27bca1e7..559a1ebaf7 100644
--- a/ext/standard/tests/array/rsort_variation6.phpt
+++ b/ext/standard/tests/array/rsort_variation6.phpt
@@ -16,7 +16,7 @@ echo "*** Testing rsort() : variation ***\n";
// an array contains unsorted hexadecimal values
$unsorted_hex_array = array(0x1AB, 0xFFF, 0xF, 0xFF, 0x2AA, 0xBB, 0x1ab, 0xff, -0xFF, 0, -0x2aa);
-echo "\n-- 'flag' value is default --\n";
+echo "\n-- 'flag' value is defualt --\n";
$temp_array = $unsorted_hex_array;
var_dump(rsort($temp_array) );
var_dump($temp_array);
@@ -34,10 +34,10 @@ var_dump($temp_array);
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing rsort() : variation ***
--- 'flag' value is default --
+-- 'flag' value is defualt --
bool(true)
array(11) {
[0]=>
@@ -117,4 +117,4 @@ array(11) {
[10]=>
int(-682)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation7.phpt b/ext/standard/tests/array/rsort_variation7.phpt
index 033eedcf9b..a996bf6db3 100644
--- a/ext/standard/tests/array/rsort_variation7.phpt
+++ b/ext/standard/tests/array/rsort_variation7.phpt
@@ -16,7 +16,7 @@ echo "*** Testing rsort() : variation ***\n";
// bool value array
$bool_values = array (true, false, TRUE, FALSE);
-echo "\n-- 'flag' value is default --\n";
+echo "\n-- 'flag' value is defualt --\n";
$temp_array = $bool_values;
var_dump(rsort($temp_array) );
var_dump($temp_array);
@@ -39,10 +39,10 @@ var_dump($temp_array);
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing rsort() : variation ***
--- 'flag' value is default --
+-- 'flag' value is defualt --
bool(true)
array(4) {
[0]=>
@@ -93,4 +93,4 @@ array(4) {
[3]=>
bool(false)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation8.phpt b/ext/standard/tests/array/rsort_variation8.phpt
index 923127d980..a4f94b5f0f 100644
--- a/ext/standard/tests/array/rsort_variation8.phpt
+++ b/ext/standard/tests/array/rsort_variation8.phpt
@@ -51,7 +51,7 @@ foreach ($various_arrays as $array) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing rsort() : variation ***
-- Iteration 1 --
@@ -177,4 +177,4 @@ array(4) {
array(0) {
}
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation9.phpt b/ext/standard/tests/array/rsort_variation9.phpt
index a78c43758e..dafe3fa090 100644
--- a/ext/standard/tests/array/rsort_variation9.phpt
+++ b/ext/standard/tests/array/rsort_variation9.phpt
@@ -54,7 +54,7 @@ foreach ($various_arrays as $array) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing rsort() : variation ***
-- Iteration 1 --
@@ -256,4 +256,4 @@ array(4) {
[3]=>
int(1)
}
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/uksort_basic.phpt b/ext/standard/tests/array/uksort_basic.phpt
new file mode 100644
index 0000000000..f83c0329da
--- /dev/null
+++ b/ext/standard/tests/array/uksort_basic.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test uksort(): basic functionality
+--FILE--
+<?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
diff --git a/ext/standard/tests/array/uksort_error.phpt b/ext/standard/tests/array/uksort_error.phpt
new file mode 100644
index 0000000000..6f447e01c5
--- /dev/null
+++ b/ext/standard/tests/array/uksort_error.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test uksort() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool uksort(array array_arg, Unicode 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===
diff --git a/ext/standard/tests/array/uksort_variation1.phpt b/ext/standard/tests/array/uksort_variation1.phpt
new file mode 100644
index 0000000000..4eeb87649a
--- /dev/null
+++ b/ext/standard/tests/array/uksort_variation1.phpt
@@ -0,0 +1,224 @@
+--TEST--
+Test uksort() function : usage variation
+--FILE--
+<?php
+/* Prototype : bool uksort(array array_arg, Unicode 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, Unicode string given in %suksort_variation1.php on line %d
+NULL
+
+--empty string SQ--
+
+Warning: uksort() expects parameter 1 to be array, Unicode string given in %suksort_variation1.php on line %d
+NULL
+
+--string DQ--
+
+Warning: uksort() expects parameter 1 to be array, Unicode string given in %suksort_variation1.php on line %d
+NULL
+
+--string SQ--
+
+Warning: uksort() expects parameter 1 to be array, Unicode string given in %suksort_variation1.php on line %d
+NULL
+
+--mixed case string--
+
+Warning: uksort() expects parameter 1 to be array, Unicode string given in %suksort_variation1.php on line %d
+NULL
+
+--heredoc--
+
+Warning: uksort() expects parameter 1 to be array, Unicode string given in %suksort_variation1.php on line %d
+NULL
+
+--instance of classWithToString--
+
+Warning: uksort() expects parameter 1 to be array, object given in %suksort_variation1.php on line %d
+NULL
+
+--instance of classWithoutToString--
+
+Warning: uksort() expects parameter 1 to be array, object given in %suksort_variation1.php on line %d
+NULL
+
+--undefined var--
+
+Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d
+NULL
+
+--unset var--
+
+Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/array/uksort_variation2.phpt b/ext/standard/tests/array/uksort_variation2.phpt
new file mode 100644
index 0000000000..daf2cae316
--- /dev/null
+++ b/ext/standard/tests/array/uksort_variation2.phpt
@@ -0,0 +1,224 @@
+--TEST--
+Test uksort() function : usage variation
+--FILE--
+<?php
+/* Prototype : bool uksort(array array_arg, Unicode 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===
diff --git a/ext/standard/tests/array/usort_basic.phpt b/ext/standard/tests/array/usort_basic.phpt
new file mode 100644
index 0000000000..fb22bf9b72
--- /dev/null
+++ b/ext/standard/tests/array/usort_basic.phpt
@@ -0,0 +1,119 @@
+--TEST--
+Test usort() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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]=>
+ unicode(4) "This"
+ [1]=>
+ unicode(1) "a"
+ [2]=>
+ unicode(2) "is"
+ [3]=>
+ unicode(4) "test"
+}
+
+-- Associative array with numeric keys --
+bool(true)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(4)
+ [3]=>
+ int(7)
+ [4]=>
+ int(9)
+}
+
+-- Associative array with string keys --
+bool(true)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(4)
+ [3]=>
+ int(10)
+}
+===DONE===
diff --git a/ext/standard/tests/array/usort_error1.phpt b/ext/standard/tests/array/usort_error1.phpt
new file mode 100644
index 0000000000..955a5614ee
--- /dev/null
+++ b/ext/standard/tests/array/usort_error1.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test usort() function : error conditions - Pass incorrect number of arguments
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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
diff --git a/ext/standard/tests/array/usort_error2.phpt b/ext/standard/tests/array/usort_error2.phpt
new file mode 100644
index 0000000000..ab604005a4
--- /dev/null
+++ b/ext/standard/tests/array/usort_error2.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test usort() function : error conditions - Pass unknown 'cmp_function'
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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
diff --git a/ext/standard/tests/array/usort_object1.phpt b/ext/standard/tests/array/usort_object1.phpt
new file mode 100644
index 0000000000..a86bab331e
--- /dev/null
+++ b/ext/standard/tests/array/usort_object1.phpt
@@ -0,0 +1,141 @@
+--TEST--
+Test usort() function : object functionality - different number of properties
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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) {
+ [u"int_value":u"SimpleClass1":private]=>
+ int(1)
+ }
+ [1]=>
+ object(SimpleClass1)#%d (1) {
+ [u"int_value":u"SimpleClass1":private]=>
+ int(10)
+ }
+ [2]=>
+ object(SimpleClass1)#%d (1) {
+ [u"int_value":u"SimpleClass1":private]=>
+ int(50)
+ }
+ [3]=>
+ object(SimpleClass1)#%d (1) {
+ [u"int_value":u"SimpleClass1":private]=>
+ int(100)
+ }
+}
+bool(true)
+array(3) {
+ [0]=>
+ object(SimpleClass2)#%d (3) {
+ [u"int_value":u"SimpleClass2":private]=>
+ int(2)
+ [u"float_value":protected]=>
+ float(3.4)
+ [u"string_value"]=>
+ unicode(5) "mango"
+ }
+ [1]=>
+ object(SimpleClass2)#%d (3) {
+ [u"int_value":u"SimpleClass2":private]=>
+ int(5)
+ [u"float_value":protected]=>
+ float(2.5)
+ [u"string_value"]=>
+ unicode(6) "orange"
+ }
+ [2]=>
+ object(SimpleClass2)#%d (3) {
+ [u"int_value":u"SimpleClass2":private]=>
+ int(10)
+ [u"float_value":protected]=>
+ float(1.2)
+ [u"string_value"]=>
+ unicode(5) "apple"
+ }
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/usort_object2.phpt b/ext/standard/tests/array/usort_object2.phpt
new file mode 100644
index 0000000000..55afb20e80
--- /dev/null
+++ b/ext/standard/tests/array/usort_object2.phpt
@@ -0,0 +1,165 @@
+--TEST--
+Test usort() function : object functionality - Different types of classes
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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) {
+ [u"child_value"]=>
+ int(15)
+ [u"pub_value"]=>
+ NULL
+ }
+ [1]=>
+ object(ChildClass)#%d (2) {
+ [u"child_value"]=>
+ int(20)
+ [u"pub_value"]=>
+ NULL
+ }
+ [2]=>
+ object(ChildClass)#%d (2) {
+ [u"child_value"]=>
+ int(500)
+ [u"pub_value"]=>
+ NULL
+ }
+ [3]=>
+ object(ChildClass)#%d (2) {
+ [u"child_value"]=>
+ int(700)
+ [u"pub_value"]=>
+ NULL
+ }
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/usort_variation1.phpt b/ext/standard/tests/array/usort_variation1.phpt
new file mode 100644
index 0000000000..af8fa2e4f8
--- /dev/null
+++ b/ext/standard/tests/array/usort_variation1.phpt
@@ -0,0 +1,236 @@
+--TEST--
+Test usort() function : usage variations - Pass different data types as $array_arg arg
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: usort() expects parameter 1 to be array, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+bool(true)
+
+-- Iteration 19 --
+
+Warning: usort() expects parameter 1 to be array, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: usort() expects parameter 1 to be array, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: usort() expects parameter 1 to be array, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: usort() expects parameter 1 to be array, object given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: usort() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: usort() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: usort() expects parameter 1 to be array, resource given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/usort_variation10.phpt b/ext/standard/tests/array/usort_variation10.phpt
new file mode 100644
index 0000000000..7f8b93070d
--- /dev/null
+++ b/ext/standard/tests/array/usort_variation10.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test usort() function : usage variations - duplicate keys and values
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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]=>
+ unicode(5) "Apple"
+ [1]=>
+ unicode(6) "Banana"
+ [2]=>
+ unicode(5) "Mango"
+ [3]=>
+ unicode(9) "Pineapple"
+}
+===DONE===
diff --git a/ext/standard/tests/array/usort_variation2.phpt b/ext/standard/tests/array/usort_variation2.phpt
new file mode 100644
index 0000000000..ef140e3f5d
--- /dev/null
+++ b/ext/standard/tests/array/usort_variation2.phpt
@@ -0,0 +1,242 @@
+--TEST--
+Test usort() function : usage variations - Pass different data types as $cmp_function arg
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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
diff --git a/ext/standard/tests/array/usort_variation3.phpt b/ext/standard/tests/array/usort_variation3.phpt
new file mode 100644
index 0000000000..daade0349e
--- /dev/null
+++ b/ext/standard/tests/array/usort_variation3.phpt
@@ -0,0 +1,115 @@
+--TEST--
+Test usort() function : usage variations - diff. array values
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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===
diff --git a/ext/standard/tests/array/usort_variation4.phpt b/ext/standard/tests/array/usort_variation4.phpt
new file mode 100644
index 0000000000..bf076f656a
--- /dev/null
+++ b/ext/standard/tests/array/usort_variation4.phpt
@@ -0,0 +1,155 @@
+--TEST--
+Test usort() function : usage variations - numeric data
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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===
diff --git a/ext/standard/tests/array/usort_variation5.phpt b/ext/standard/tests/array/usort_variation5.phpt
new file mode 100644
index 0000000000..e191212dbd
--- /dev/null
+++ b/ext/standard/tests/array/usort_variation5.phpt
@@ -0,0 +1,143 @@
+--TEST--
+Test usort() function : usage variations - string data
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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]=>
+ unicode(0) ""
+ [1]=>
+ unicode(1) " "
+ [2]=>
+ unicode(1) "'"
+ [3]=>
+ unicode(1) "0"
+ [4]=>
+ unicode(8) "123Hello"
+ [5]=>
+ unicode(4) "@#$%"
+ [6]=>
+ unicode(5) "HELLO"
+ [7]=>
+ unicode(5) "Hello"
+ [8]=>
+ unicode(2) "\t"
+ [9]=>
+ unicode(4) "test"
+}
+
+-- Sorting Double Quoted String values --
+bool(true)
+array(10) {
+ [0]=>
+ unicode(0) ""
+ [1]=>
+ unicode(1) " "
+ [2]=>
+ unicode(1) " "
+ [3]=>
+ unicode(1) """
+ [4]=>
+ unicode(1) "0"
+ [5]=>
+ unicode(8) "123Hello"
+ [6]=>
+ unicode(4) "@#$%"
+ [7]=>
+ unicode(5) "HELLO"
+ [8]=>
+ unicode(5) "Hello"
+ [9]=>
+ unicode(4) "test"
+}
+
+-- Sorting Heredoc String values --
+bool(true)
+array(4) {
+ [0]=>
+ unicode(0) ""
+ [1]=>
+ unicode(7) "HEREDOC"
+ [2]=>
+ unicode(7) "Heredoc"
+ [3]=>
+ unicode(%d) "heredoc string with!@# and 123
+Test this!!!"
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/usort_variation6.phpt b/ext/standard/tests/array/usort_variation6.phpt
new file mode 100644
index 0000000000..f5a554c0f0
--- /dev/null
+++ b/ext/standard/tests/array/usort_variation6.phpt
@@ -0,0 +1,139 @@
+--TEST--
+Test usort() function : usage variations - multi-dimensional arrays
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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]=>
+ unicode(0) ""
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [4]=>
+ array(1) {
+ [0]=>
+ int(100)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(-1)
+ }
+ [6]=>
+ array(5) {
+ [0]=>
+ int(-9)
+ [1]=>
+ int(34)
+ [2]=>
+ int(54)
+ [3]=>
+ int(0)
+ [4]=>
+ int(20)
+ }
+ [7]=>
+ array(5) {
+ [0]=>
+ unicode(5) "apple"
+ [1]=>
+ unicode(5) "Apple"
+ [2]=>
+ unicode(5) "APPLE"
+ [3]=>
+ unicode(5) "aPPle"
+ [4]=>
+ unicode(5) "aPpLe"
+ }
+}
+
+-- Pass usort() a sub-array --
+bool(true)
+-- Array after call to usort() --
+array(5) {
+ [0]=>
+ int(-9)
+ [1]=>
+ int(0)
+ [2]=>
+ int(20)
+ [3]=>
+ int(34)
+ [4]=>
+ int(54)
+}
+===DONE===
diff --git a/ext/standard/tests/array/usort_variation7.phpt b/ext/standard/tests/array/usort_variation7.phpt
new file mode 100644
index 0000000000..84775d7117
--- /dev/null
+++ b/ext/standard/tests/array/usort_variation7.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test usort() function : usage variations - Anonymous comparison function
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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]=>
+ unicode(5) "Apple"
+ [1]=>
+ unicode(6) "Banana"
+ [2]=>
+ unicode(5) "Mango"
+ [3]=>
+ unicode(9) "Pineapple"
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/usort_variation8.phpt b/ext/standard/tests/array/usort_variation8.phpt
new file mode 100644
index 0000000000..db924794bd
--- /dev/null
+++ b/ext/standard/tests/array/usort_variation8.phpt
@@ -0,0 +1,85 @@
+--TEST--
+Test usort() function : usage variations - use built in functions as $cmp_function arg
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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]=>
+ unicode(5) "apple"
+ [1]=>
+ unicode(6) "Banana"
+ [2]=>
+ unicode(5) "Mango"
+ [3]=>
+ unicode(6) "orange"
+ [4]=>
+ unicode(9) "Pineapple"
+}
+
+-- Testing usort() with built-in 'cmp_function': strcmp() --
+bool(true)
+array(5) {
+ [0]=>
+ unicode(6) "Banana"
+ [1]=>
+ unicode(5) "Mango"
+ [2]=>
+ unicode(9) "Pineapple"
+ [3]=>
+ unicode(5) "apple"
+ [4]=>
+ unicode(6) "orange"
+}
+
+-- Testing usort() with language construct as 'cmp_function' --
+
+Warning: usort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
+NULL
+
+-- Testing usort() with language construct as 'cmp_function' --
+
+Warning: usort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/array/usort_variation9.phpt b/ext/standard/tests/array/usort_variation9.phpt
new file mode 100644
index 0000000000..d727cf0e53
--- /dev/null
+++ b/ext/standard/tests/array/usort_variation9.phpt
@@ -0,0 +1,66 @@
+--TEST--
+Test usort() function : usage variations - referenced variables
+--FILE--
+<?php
+/* Prototype : bool usort(array $array_arg, Unicode 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===