]> granicus.if.org Git - php/commitdiff
Array tests: checked on PHP 5.2.6, 5.3 and 6.0 (Windows, Linux and Linux 64 bit).
authorAnt Phillips <ant@php.net>
Tue, 2 Dec 2008 13:29:17 +0000 (13:29 +0000)
committerAnt Phillips <ant@php.net>
Tue, 2 Dec 2008 13:29:17 +0000 (13:29 +0000)
179 files changed:
ext/standard/tests/array/array_count_values_error.phpt [new file with mode: 0644]
ext/standard/tests/array/array_count_values_variation.phpt [new file with mode: 0644]
ext/standard/tests/array/array_diff_assoc_error.phpt
ext/standard/tests/array/array_diff_key_error.phpt [new file with mode: 0644]
ext/standard/tests/array/array_diff_key_variation1.phpt
ext/standard/tests/array/array_diff_key_variation2.phpt [new file with mode: 0644]
ext/standard/tests/array/array_diff_key_variation3.phpt [new file with mode: 0644]
ext/standard/tests/array/array_diff_key_variation4.phpt [new file with mode: 0644]
ext/standard/tests/array/array_diff_key_variation5.phpt [new file with mode: 0644]
ext/standard/tests/array/array_diff_key_variation6.phpt [new file with mode: 0644]
ext/standard/tests/array/array_diff_key_variation7.phpt [new file with mode: 0644]
ext/standard/tests/array/array_diff_key_variation8.phpt [new file with mode: 0644]
ext/standard/tests/array/array_diff_uassoc_error.phpt
ext/standard/tests/array/array_diff_uassoc_variation14.phpt [new file with mode: 0644]
ext/standard/tests/array/array_diff_ukey_variation11.phpt [new file with mode: 0644]
ext/standard/tests/array/array_diff_ukey_variation3.phpt
ext/standard/tests/array/array_fill_keys_error.phpt [new file with mode: 0644]
ext/standard/tests/array/array_fill_keys_variation1.phpt [new file with mode: 0644]
ext/standard/tests/array/array_fill_keys_variation2.phpt [new file with mode: 0644]
ext/standard/tests/array/array_fill_keys_variation3.phpt [new file with mode: 0644]
ext/standard/tests/array/array_fill_keys_variation4.phpt [new file with mode: 0644]
ext/standard/tests/array/array_intersect_assoc_variation5.phpt
ext/standard/tests/array/array_intersect_assoc_variation6.phpt
ext/standard/tests/array/array_intersect_key_variation2.phpt
ext/standard/tests/array/array_intersect_key_variation3.phpt
ext/standard/tests/array/array_intersect_uassoc_variation10.phpt
ext/standard/tests/array/array_intersect_uassoc_variation11.phpt [new file with mode: 0644]
ext/standard/tests/array/array_intersect_ukey_variation10.phpt [new file with mode: 0644]
ext/standard/tests/array/array_intersect_variation5.phpt
ext/standard/tests/array/array_intersect_variation6.phpt
ext/standard/tests/array/array_map_variation19.phpt [new file with mode: 0644]
ext/standard/tests/array/array_multisort_basic1.phpt
ext/standard/tests/array/array_multisort_basic2.phpt
ext/standard/tests/array/array_multisort_variation5.phpt
ext/standard/tests/array/array_multisort_variation6.phpt
ext/standard/tests/array/array_multisort_variation7.phpt
ext/standard/tests/array/array_multisort_variation8.phpt
ext/standard/tests/array/array_multisort_variation9.phpt
ext/standard/tests/array/array_next_error1.phpt [new file with mode: 0644]
ext/standard/tests/array/array_next_error2.phpt [new file with mode: 0644]
ext/standard/tests/array/array_product_error.phpt
ext/standard/tests/array/array_product_variation2.phpt
ext/standard/tests/array/array_product_variation3.phpt
ext/standard/tests/array/array_product_variation4.phpt
ext/standard/tests/array/array_product_variation5.phpt
ext/standard/tests/array/array_rand_variation4.phpt
ext/standard/tests/array/array_reduce_error.phpt [new file with mode: 0644]
ext/standard/tests/array/array_reduce_variation1.phpt [new file with mode: 0644]
ext/standard/tests/array/array_reduce_variation2.phpt [new file with mode: 0644]
ext/standard/tests/array/array_reduce_variation3.phpt [new file with mode: 0644]
ext/standard/tests/array/array_slice_variation1.phpt
ext/standard/tests/array/array_udiff_assoc_error.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_assoc_variation.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_assoc_variation1.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_assoc_variation2.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_assoc_variation3.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_assoc_variation4.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_assoc_variation5.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_error.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_uassoc_error.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_uassoc_variation1.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_uassoc_variation2.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_uassoc_variation3.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_uassoc_variation4.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_uassoc_variation5.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_uassoc_variation6.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_variation1.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_variation2.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_variation3.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_variation4.phpt [new file with mode: 0644]
ext/standard/tests/array/array_udiff_variation5.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_assoc_basic2.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_assoc_error.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_assoc_variation1.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_assoc_variation2.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_assoc_variation3.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_assoc_variation4.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_assoc_variation5.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_error.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_uassoc_error.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_uassoc_variation3.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_uassoc_variation4.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_variation1.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_variation2.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_variation3.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_variation4.phpt [new file with mode: 0644]
ext/standard/tests/array/array_uintersect_variation5.phpt [new file with mode: 0644]
ext/standard/tests/array/array_unshift_variation1.phpt
ext/standard/tests/array/array_values_error.phpt [new file with mode: 0644]
ext/standard/tests/array/array_values_variation7.phpt
ext/standard/tests/array/arsort_basic.phpt [new file with mode: 0644]
ext/standard/tests/array/arsort_object1.phpt [new file with mode: 0644]
ext/standard/tests/array/arsort_object2.phpt [new file with mode: 0644]
ext/standard/tests/array/arsort_variation3.phpt
ext/standard/tests/array/bug44181.phpt [new file with mode: 0644]
ext/standard/tests/array/bug44182.phpt [new file with mode: 0644]
ext/standard/tests/array/compact_variation1.phpt
ext/standard/tests/array/compact_variation2.phpt [new file with mode: 0644]
ext/standard/tests/array/compare_function.inc [new file with mode: 0644]
ext/standard/tests/array/current_basic.phpt
ext/standard/tests/array/current_variation1.phpt
ext/standard/tests/array/current_variation3.phpt
ext/standard/tests/array/current_variation4.phpt
ext/standard/tests/array/each_basic.phpt
ext/standard/tests/array/each_error.phpt
ext/standard/tests/array/each_variation2.phpt
ext/standard/tests/array/each_variation3.phpt
ext/standard/tests/array/each_variation4.phpt
ext/standard/tests/array/each_variation5.phpt
ext/standard/tests/array/each_variation6.phpt
ext/standard/tests/array/end_basic.phpt
ext/standard/tests/array/end_variation1.phpt
ext/standard/tests/array/end_variation2.phpt
ext/standard/tests/array/end_variation3.phpt
ext/standard/tests/array/key_basic.phpt
ext/standard/tests/array/key_variation1.phpt
ext/standard/tests/array/key_variation2.phpt
ext/standard/tests/array/key_variation3.phpt
ext/standard/tests/array/key_variation4.phpt
ext/standard/tests/array/natcasesort_basic.phpt
ext/standard/tests/array/natcasesort_error.phpt
ext/standard/tests/array/natcasesort_variation1.phpt
ext/standard/tests/array/natcasesort_variation10.phpt
ext/standard/tests/array/natcasesort_variation11.phpt
ext/standard/tests/array/natcasesort_variation2.phpt
ext/standard/tests/array/natcasesort_variation3.phpt
ext/standard/tests/array/natcasesort_variation4.phpt
ext/standard/tests/array/natcasesort_variation5.phpt
ext/standard/tests/array/natcasesort_variation6.phpt
ext/standard/tests/array/natcasesort_variation7.phpt
ext/standard/tests/array/natcasesort_variation8.phpt
ext/standard/tests/array/natcasesort_variation9.phpt
ext/standard/tests/array/natsort_basic.phpt [new file with mode: 0644]
ext/standard/tests/array/next_basic.phpt
ext/standard/tests/array/next_variation1.phpt
ext/standard/tests/array/next_variation2.phpt
ext/standard/tests/array/prev_variation1.phpt
ext/standard/tests/array/reset_basic.phpt
ext/standard/tests/array/reset_variation1.phpt
ext/standard/tests/array/reset_variation2.phpt
ext/standard/tests/array/reset_variation3.phpt
ext/standard/tests/array/rsort_basic.phpt
ext/standard/tests/array/rsort_error.phpt
ext/standard/tests/array/rsort_object1.phpt
ext/standard/tests/array/rsort_object2.phpt
ext/standard/tests/array/rsort_variation1.phpt
ext/standard/tests/array/rsort_variation10.phpt
ext/standard/tests/array/rsort_variation11.phpt
ext/standard/tests/array/rsort_variation2.phpt
ext/standard/tests/array/rsort_variation3.phpt
ext/standard/tests/array/rsort_variation4.phpt
ext/standard/tests/array/rsort_variation5.phpt
ext/standard/tests/array/rsort_variation6.phpt
ext/standard/tests/array/rsort_variation7.phpt
ext/standard/tests/array/rsort_variation8.phpt
ext/standard/tests/array/rsort_variation9.phpt
ext/standard/tests/array/uksort_basic.phpt [new file with mode: 0644]
ext/standard/tests/array/uksort_error.phpt [new file with mode: 0644]
ext/standard/tests/array/uksort_variation1.phpt [new file with mode: 0644]
ext/standard/tests/array/uksort_variation2.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_basic.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_error1.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_error2.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_object1.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_object2.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_variation1.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_variation10.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_variation2.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_variation3.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_variation4.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_variation5.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_variation6.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_variation7.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_variation8.phpt [new file with mode: 0644]
ext/standard/tests/array/usort_variation9.phpt [new file with mode: 0644]

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 (file)
index 0000000..843e34e
--- /dev/null
@@ -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 (file)
index 0000000..488b04e
--- /dev/null
@@ -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
index 1aa7a08bc53de4787416cbc9d137e57237e2711b..211907c726d4854aa0789b3d292f80736fbccf71 100644 (file)
@@ -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 (file)
index 0000000..90168f5
--- /dev/null
@@ -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===
index b322a5fa93bae0dd9cae173bea196832cc56d318..52b703fb7722453becd5d500cc14b92ae7bba2de 100644 (file)
 --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 (file)
index 0000000..737ee2e
--- /dev/null
@@ -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 (file)
index 0000000..28f4c05
--- /dev/null
@@ -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 (file)
index 0000000..d64f990
--- /dev/null
@@ -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 (file)
index 0000000..ba98a2e
--- /dev/null
@@ -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 (file)
index 0000000..eec9934
--- /dev/null
@@ -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 (file)
index 0000000..76b747c
--- /dev/null
@@ -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 (file)
index 0000000..f8106d8
--- /dev/null
@@ -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
index a2f98204426d4a00aa99c107d4699983b29791ee..0f9f82464cc82d2b5c4dc703d44acaeb1344d7b3 100644 (file)
@@ -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 (file)
index 0000000..a98a280
--- /dev/null
@@ -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 (file)
index 0000000..4882e72
--- /dev/null
@@ -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
index 309dae45a46cfe9d3ed6cab362dc560b6051ca46..f7a2ea8620f31daec6688ff95b54d31bdcc515c8 100644 (file)
@@ -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 (file)
index 0000000..64fd0e5
--- /dev/null
@@ -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 (file)
index 0000000..796a9be
--- /dev/null
@@ -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 (file)
index 0000000..df7f389
--- /dev/null
@@ -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 (file)
index 0000000..09cfadc
--- /dev/null
@@ -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 (file)
index 0000000..0a1659f
--- /dev/null
@@ -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
index be308a48d3dc918733198ab9b546d9f8aea4c29b..36b99028e6fdaba736023ca5dbd0752db55a49df 100644 (file)
@@ -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) {
 }
index 099599328875a087200ace0d719c3aebeb14b3bc..ccaaf502171cabb8bd2586fd5875e43e6ebb4627 100644 (file)
@@ -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) {
 }
index 9137a602d950b9d33423472892672fd697230587..3c33debebe7393bdfdc50d54ea6f3557163e3503 100644 (file)
@@ -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) );
index 2eaf7213c618e44112cf70499e14fd61226ca47e..8fd3d3c77fde08ccbc4e17e063a9697844214192 100644 (file)
@@ -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) );
index 7089e634756013c92064980560225c0095281188..b6a9497082192bd0da89f8c47981a787cf1d2dd5 100644 (file)
@@ -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 (file)
index 0000000..ba3776e
--- /dev/null
@@ -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 (file)
index 0000000..b080eb2
--- /dev/null
@@ -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
index abb2407792c451d7aef39832e52494b93d3fdfca..d8fc8fe8a5f7eb52b5c3401e5364bd18a7845c3f 100644 (file)
@@ -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) {
 }
index d288b57b6c353840c80fef294f7643496444f998..326b6f514c61b27dd8e884ead47620620b901036 100644 (file)
@@ -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 (file)
index 0000000..134836e
--- /dev/null
@@ -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
index 3bdf63a92544f610cb3f654e10a77e4c7bba9bfc..97475191bdd3f67de7617e62db429e8dd0287cd3 100644 (file)
@@ -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
index 1ce594c17b91af950cc56078a38fb10d6cf8ca18..d51283c31665820d71d2b6e6e39e1e65de064d77 100644 (file)
@@ -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)
 }
index d2208107854e36e882c036fc60bff6902cdce96d..ad7a25dae448e2cde8a38adfa682cda5401f4f53 100644 (file)
@@ -50,4 +50,4 @@ array(3) {
   [2]=>
   int(2)
 }
-===DONE===
\ No newline at end of file
+===DONE===
index af209713fcf587041252b5c3bb664cfc9b3ea055..c3da6216626653518540449a469d9db51d34d58f 100644 (file)
@@ -50,4 +50,4 @@ array(3) {
   [2]=>
   unicode(2) "aa"
 }
-===DONE===
\ No newline at end of file
+===DONE===
index 106f6002be76f0bf9b71e1e2921eda7c9341f6e7..ff285b13233d1864cd621dd98af8c44b2a1273a2 100644 (file)
@@ -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===
index 9a5ae571b4633187ba7671dcb20d8f1d347dba25..3ee3d9a56d16c3fc1e0e4f6eec5f844c15c29393 100644 (file)
@@ -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===
index 4713bbdb1fb6e50d915fdaf2a807a09d006722c4..ea78774270752c00674b14f3611e8b708c524625 100644 (file)
@@ -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 (file)
index 0000000..72f2cb9
--- /dev/null
@@ -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 (file)
index 0000000..d4f1666
--- /dev/null
@@ -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
index b8465bc605ebcfc3577a79fe474f6cf1bb4a4849..2d12a44ffe06158e58bc6cd04d3a3e78ea5e49e6 100644 (file)
@@ -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===
index 94a54505e2d673a13e6e3619bc1158f7d0890add..c4c47d86a2bf13cea8f01eeb7c9feeb896db2531 100644 (file)
@@ -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===
index 87b7be756a781a03b91b59548762d7a9bd22503a..dc8609ebd8043d5c619dccce7806331ad2427ead 100644 (file)
@@ -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)
index a018611d3eb19d84caa7f6f824beca4b32d20f55..9f83c5646bd58789e45af5539197f21fe0a9c7f4 100644 (file)
@@ -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)
index 33e7997d0a0264228fc7087ba1e4580259d2cf0c..ddbb2ee704eed2555a25c9b5f37afd36e029c905 100644 (file)
@@ -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===
index e0eddbb5aca0ba16942a4b3480903f8fcb67c7e4..2bf7e9c09fcd28837c9c8d1776f12c950962a774 100644 (file)
@@ -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 (file)
index 0000000..954aa43
--- /dev/null
@@ -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 (file)
index 0000000..b02a82a
--- /dev/null
@@ -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 (file)
index 0000000..d68372f
--- /dev/null
@@ -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 (file)
index 0000000..f630102
--- /dev/null
@@ -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
index 01fcc0bc077584f506ce6f5614a1b322cacbd1d0..f3c93265ed2dfd4e28a073cf23043b96c25e64fc 100644 (file)
 --TEST--
-Test array_slice() - Third parameter (NULL vs 0)
+Test array_slice() function : usage variations - Pass different data types as $input arg
 --FILE--
 <?php
+/* Prototype  : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length 
+ * Source code: ext/standard/array.c
+ */
 
-var_dump(array_slice(range(1, 3), 0, NULL, 1));
-var_dump(array_slice(range(1, 3), 0, 0, 1));
-var_dump(array_slice(range(1, 3), 0, NULL));
-var_dump(array_slice(range(1, 3), 0, 0));
+/*
+ * Pass different arguments as $input argument to array_slice() to test behaviour
+ */
 
-var_dump(array_slice(range(1, 3), -1, 0));
-var_dump(array_slice(range(1, 3), -1, 0, 1));
-var_dump(array_slice(range(1, 3), -1, NULL));
-var_dump(array_slice(range(1, 3), -1, NULL, 1));
+echo "*** Testing array_slice() : usage variations ***\n";
 
+// Initialise function arguments not being substituted
+$offset = 2;
 
-$a = 'foo';
-var_dump(array_slice(range(1, 3), 0, $a));
-var_dump(array_slice(range(1, 3), 0, $a));
-var_dump($a);
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
 
+// get a class
+class classA
+{
+  public function __toString() {
+    return "Class A object";
+  }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$inputs = array(
+
+       // int data
+/*1*/  0,
+       1,
+       12345,
+       -2345,
+
+       // float data
+/*5*/  10.5,
+       -10.5,
+       12.3456789000e10,
+       12.3456789000E-10,
+       .5,
+
+       // null data
+/*10*/ NULL,
+       null,
+
+       // boolean data
+/*12*/ true,
+       false,
+       TRUE,
+       FALSE,
+       
+       // empty data
+/*16*/ "",
+       '',
+       array(),
+
+       // string data
+/*19*/ "string",
+       'string',
+       $heredoc,
+       
+       // object data
+/*22*/ new classA(),
+
+       // undefined data
+/*23*/ @$undefined_var,
+
+       // unset data
+/*24*/ @$unset_var,
+
+       // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_slice()
+$iterator = 1;
+foreach($inputs as $input) {
+  echo "\n-- Iteration $iterator --\n";
+  var_dump( array_slice($input, $offset) );
+  $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
 ?>
 
---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 (file)
index 0000000..ec1cc06
--- /dev/null
@@ -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 (file)
index 0000000..0c36a8e
--- /dev/null
@@ -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 (file)
index 0000000..9886d73
--- /dev/null
@@ -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 (file)
index 0000000..18484a7
--- /dev/null
@@ -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 (file)
index 0000000..e693aff
--- /dev/null
@@ -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 (file)
index 0000000..0bf3e2d
--- /dev/null
@@ -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 (file)
index 0000000..6938076
--- /dev/null
@@ -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 (file)
index 0000000..dc96577
--- /dev/null
@@ -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 (file)
index 0000000..e7d27e6
--- /dev/null
@@ -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 (file)
index 0000000..a48d56d
--- /dev/null
@@ -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 (file)
index 0000000..c205da7
--- /dev/null
@@ -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 (file)
index 0000000..76afda0
--- /dev/null
@@ -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 (file)
index 0000000..0beb15f
--- /dev/null
@@ -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 (file)
index 0000000..87c7071
--- /dev/null
@@ -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 (file)
index 0000000..ec752a3
--- /dev/null
@@ -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 (file)
index 0000000..d2c0e24
--- /dev/null
@@ -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 (file)
index 0000000..fd2c12d
--- /dev/null
@@ -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 (file)
index 0000000..aeeee89
--- /dev/null
@@ -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 (file)
index 0000000..09dec4f
--- /dev/null
@@ -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 (file)
index 0000000..49405d4
--- /dev/null
@@ -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 (file)
index 0000000..561a60d
--- /dev/null
@@ -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 (file)
index 0000000..73fc61e
--- /dev/null
@@ -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 (file)
index 0000000..45d0a8d
--- /dev/null
@@ -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 (file)
index 0000000..a421c25
--- /dev/null
@@ -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 (file)
index 0000000..a76fca0
--- /dev/null
@@ -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 (file)
index 0000000..abff23a
--- /dev/null
@@ -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 (file)
index 0000000..e2d7bd0
--- /dev/null
@@ -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 (file)
index 0000000..1b25db4
--- /dev/null
@@ -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 (file)
index 0000000..c7391ee
--- /dev/null
@@ -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 (file)
index 0000000..764c584
--- /dev/null
@@ -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 (file)
index 0000000..2efa93d
--- /dev/null
@@ -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 (file)
index 0000000..860a166
--- /dev/null
@@ -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 (file)
index 0000000..a396318
--- /dev/null
@@ -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 (file)
index 0000000..061ac60
--- /dev/null
@@ -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 (file)
index 0000000..6ed86f8
--- /dev/null
@@ -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 (file)
index 0000000..0663a95
--- /dev/null
@@ -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 (file)
index 0000000..79f4cd0
--- /dev/null
@@ -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 (file)
index 0000000..707ba11
--- /dev/null
@@ -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 (file)
index 0000000..45207b3
--- /dev/null
@@ -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 (file)
index 0000000..75cf08e
--- /dev/null
@@ -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===
index 7fc6ec82e0a3aa54b0ba579dbe5638f27f038c02..998d6b99d8e213700264774a43ce0f72cedcd6b7 100644 (file)
@@ -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 (file)
index 0000000..07d682c
--- /dev/null
@@ -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
+
index 01d549672c93d405a56ee40ad380d55b3b9b892c..72405acf0da6586f6c0eb597cc4362aad6804810 100644 (file)
@@ -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 (file)
index 0000000..ad1e003
--- /dev/null
@@ -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 (file)
index 0000000..6dca495
--- /dev/null
@@ -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 (file)
index 0000000..215e59d
--- /dev/null
@@ -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
index dab0ee51594e291e6765bf6d3d2a39cdae8268fe..0ceba736ae1a4264bac969af65b712af7124e9db 100644 (file)
@@ -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 (file)
index 0000000..f773bbf
--- /dev/null
@@ -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 (file)
index 0000000..076b409
--- /dev/null
@@ -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
+
index 712ea738fd9c54316f8be84508d8aebadba25039..c41126e732db3a6a37776aa0e6091fc7735c7b95 100644 (file)
@@ -32,6 +32,33 @@ echo "Done";
 --EXPECTF--
 *** Testing compact() : usage variations  - arrays containg references ***
 
+Warning: compact(): recursion detected in %s on line %d
+array(1) {
+  ["a"]=>
+  int(1)
+}
+
+Warning: compact(): recursion detected in %s on line %d
+
+Warning: compact(): recursion detected in %s on line %d
+
+Warning: compact(): recursion detected in %s on line %d
+
+Warning: compact(): recursion detected in %s on line %d
+array(2) {
+  ["a"]=>
+  int(1)
+  ["b"]=>
+  int(2)
+}
+array(1) {
+  ["c"]=>
+  int(3)
+}
+Done
+--UEXPECTF--
+*** Testing compact() : usage variations  - arrays containg references ***
+
 Warning: compact(): recursion detected in %s on line %d
 array(1) {
   [u"a"]=>
@@ -55,4 +82,4 @@ array(1) {
   [u"c"]=>
   int(3)
 }
-Done
+Done
\ No newline at end of file
diff --git a/ext/standard/tests/array/compact_variation2.phpt b/ext/standard/tests/array/compact_variation2.phpt
new file mode 100644 (file)
index 0000000..66b6bdb
--- /dev/null
@@ -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 (file)
index 0000000..e517680
--- /dev/null
@@ -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
index adfe7da0532a1dd17f57c855b1cfcbf9ac33a18d..3ef4740392b09d89fa1ac08b971dce6a8214511e 100644 (file)
@@ -23,7 +23,7 @@ next($array);
 var_dump(current($array));
 ?>
 ===DONE===
---EXPECT--
+--EXPECTF--
 *** Testing current() : basic functionality ***
 unicode(4) "zero"
 unicode(3) "one"
index 24accd4a6f17a627ef0c39bdf03756c100c1b345..8acbcf3c85c07a249296defcc74f4472b2406439 100644 (file)
@@ -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===
+
index 1cfd802a56234274b22fd4338a948faf0c30d42d..8c28be4cd7e3619190f71bfe545b7ade153d5315 100644 (file)
@@ -30,7 +30,7 @@ echo "\$array2: ";
 var_dump(current($array2));
 ?>
 ===DONE===
---EXPECT--
+--EXPECTF--
 *** Testing current() : usage variations ***
 
 -- Initial position of internal pointer --
index 5f42fa45de653cae2ed59a1903ac24fb6ee04f63..e1260f11f3ceaebe1eac839e8792f3d0ae431592 100644 (file)
@@ -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 --
index e9c05d50772ac06b2e700261e096b4d256e42415..58a552f094a520fa5bf8c9e69cf5b261a291cf8c 100644 (file)
@@ -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
index 489681a5fa3e14f1c317fe5dec5d59dabb8d469f..0806bee674a25e04f16a8b3a6f135a735f1a7717 100644 (file)
@@ -40,3 +40,4 @@ NULL
 Warning: each() expects exactly 1 parameter, 2 given in %s on line %d
 NULL
 Done
+
index fbb5feebfe3fafb7ae91801db5d23ff4bddf060d..eb12212e3df0626e8d4af8eca2f5cccf597cf8ca 100644 (file)
@@ -245,4 +245,4 @@ array(4) {
   [u"key"]=>
   int(0)
 }
-Done
+Done
\ No newline at end of file
index ff1791aa714dba988725b0bb2c17f3c8665ad5a7..0333c8880f430174fd4c1dfb07f6321172f851ed 100644 (file)
@@ -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
index 765159441bcbd30872788118ac4654e742dced61..f05a7c9aed4c06fe7b2c3695ffd02d727c3000f4 100644 (file)
@@ -86,4 +86,4 @@ array(3) {
   [2]=>
   unicode(3) "two"
 }
-Done
+Done
\ No newline at end of file
index 09bf3f4f6da270c89d6ba029f1b49d9b602dfa4e..495927494b4e71e49d921d101beffcb234e904d5 100644 (file)
@@ -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
index 5fa5460188d54e970483f380255ad6cefa58e98e..e2b49a57281e261f97def5534d45e030d84a6930 100644 (file)
@@ -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
index 56f037ab2ff2956f6a6d7cc2c2ba4a6a6acf4d62..d384f7d2aee6b498f27e4165caaed66764f0d38b 100644 (file)
@@ -29,7 +29,7 @@ $array[2] = 'foo';
 var_dump(end($array));
 ?>
 ===DONE===
---EXPECT--
+--EXPECTF--
 *** Testing end() : basic functionality ***
 
 -- Initial Position: --
index 5ad896109f834be0eb0a3fd3425868b0ede67fc0..8676a71da541c85f8fbf5c110d448262fdae4b9b 100644 (file)
@@ -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===
+
index ea9c336ac0ff9aae314aa15f082f16b3280c199b..180f7cdfbdde37956151e5e2d1f04ddf332586cf 100644 (file)
@@ -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 --
index 0a8334294999018b1781cc3a253cf22f28147160..1a28ec9901c6ed47a060c2a43e8e16f42675b191 100644 (file)
@@ -29,7 +29,7 @@ echo "\$array2: ";
 var_dump(current($array2));
 ?>
 ===DONE===
---EXPECT--
+--EXPECTF--
 *** Testing end() : usage variations ***
 
 -- Initial position of internal pointer --
index 0b4377ef52af2fb1d398650d2e3d6d2276b6a6b9..f25e60d931ab01d66de9928247b5c9c158e020a4 100644 (file)
@@ -30,7 +30,7 @@ next($array);
 var_dump(key($array));
 ?>
 ===DONE===
---EXPECT--
+--EXPECTF--
 *** Testing key() : basic functionality ***
 
 -- Initial Position: --
index 93d0ebc7142f756849a15e1d81d55d447d251d94..2dd87dd45aac20cc66cf5db5c6cb0267d10fc037 100644 (file)
@@ -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===
+
index 6a463b9fdf96abf6c7ee77fa9c476d8ee5be580a..3d3401d7517d86d9fe7057284ec1fe2e48db70b6 100644 (file)
@@ -104,7 +104,7 @@ foreach($inputs as $key => $input) {
 };
 ?>
 ===DONE===
---EXPECT--
+--EXPECTF--
 *** Testing key() : usage variations ***
 
 -- Iteration 1 : int data --
index 916e99af38424cb588db95bf476c2ae017986e28..a231917814ea4aa908eab9f9942a6aca702b649b 100644 (file)
@@ -31,7 +31,7 @@ echo "\$array2: ";
 var_dump(key($array2));
 ?>
 ===DONE===
---EXPECT--
+--EXPECTF--
 *** Testing key() : usage variations ***
 
 -- Initial position of internal pointer --
index 6698d6385a5b5e5249f32bee7d7bc467af029daa..147d55aa13b5f9c9f65814da807ca2b548453858 100644 (file)
@@ -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 --
index 06dfb6c277423f383f3f79ffd71cd676cda788e1..4a9c5b5f97218a87073de101e586b10b84f72731 100644 (file)
@@ -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
index 377a407d72044127daed403de91cf9952c4ba58a..9ae8691e1e5e9a9bbaa086a68dbb8a29e4add7fd 100644 (file)
@@ -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
index 6c4fbec53c9fe91f40658d3edf77082d909453ab..918e051e6b7cd6c752fc7b90b0d625a42dbe035e 100644 (file)
@@ -220,3 +220,4 @@ NULL
 Warning: natcasesort() expects parameter 1 to be array, resource given in %s on line %d
 NULL
 Done
+
index 09f69eb93db639b05c7d59194251faae21e098d4..00db813804a64082e10b4b966e60ae660c7ea4a6 100644 (file)
@@ -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: --
index c25e6c42dab06180689488e458127f3352b3c595..604c2199352b1dbe8a7b719de3c8e7d0bb829c56 100644 (file)
@@ -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
index eb592997d4ea6444dc94d260bc848bbce54dd7a5..764d8fa77e1f1dc8f5ce77a99a8829b1d39656d9 100644 (file)
@@ -224,4 +224,4 @@ array(1) {
   [0]=>
   resource(%d) of type (stream)
 }
-Done
+Done
\ No newline at end of file
index 08db8749176e7b8b0659124bb4305645cdbd5311..77f83e1d09d46cc6c3d886d74cd414eb21076425 100644 (file)
@@ -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
index 8c655bd0c3ff83f61c0b25b71d38bf34a747898b..b3bb8b5a15b452ceffb8f7c165b0d81f6633ada8 100644 (file)
@@ -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
+
index f2cbd17191150b86ef85a0a2c5b74805fe794eb7..867d0b89e47acbb2875758eaca2c9af9f49eee82 100644 (file)
@@ -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
index bbbefa799e21509ae4c54ef8082e143768533966..1d151d80d3347f953268e50175bc1278375b1043 100644 (file)
@@ -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
index f4c70702de99b2a3fd8324617deaca57bb9f0520..e53e34ced12013c8fa891d7e97de0041ca9b1ee5 100644 (file)
@@ -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
index b0f7cbba5079d6c9b92684def612dcc4a4bc0598..fbced4a229e66f0c0edb7fd83398dd045a6ef4d2 100644 (file)
@@ -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
index 156375941b1861e317e92796dc43fca66a4c1ffd..cdb02982f32cc731986ce24b16733b97c278d519 100644 (file)
@@ -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 (file)
index 0000000..e38359f
--- /dev/null
@@ -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
+)
+
index 358e396e5f4b057f202a9b60e0763afc1525353b..c0e7accf0d27b4f35dd4fa35bbb053aea37abd22 100644 (file)
@@ -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"
index 959b3b6ee08937e2e6c34a602332d22359238dff..45ed54858884508fc81b78f5ba11806c9ef3e393 100644 (file)
@@ -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===
+
index 1ecde7efce448b0dc59f89e548221aed9cd61137..e7505096d9a3a9de5a5d4fb0172cf1613d59e196 100644 (file)
@@ -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 --
index 43b73e850bef6188080387855accd5fec9b271d0..837b2e16e6f4a2782757542956bb6b206162eae7 100755 (executable)
@@ -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===
+
index b18f6ff64bdb35f832354718ee9fd2b8cf4eb3d1..e29bcb5e47f208c330c8af53555fa660b20afef7 100644 (file)
@@ -28,7 +28,7 @@ echo "\n-- Call to reset() --\n";
 var_dump(reset($array));
 ?>
 ===DONE===
---EXPECT--
+--EXPECTF--
 *** Testing reset() : basic functionality ***
 
 -- Initial Position: --
index 1637789eb8d49419a19de00e101b0d9c2576e6f1..4743ca66823d4e7923faf43ed0941dcb59f4d771 100644 (file)
@@ -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===
+
index 713c88adde6c8a4e2af152c0e5428a999930da81..43b7875a01825e59c2277758d9f3c3319ea7e9fb 100644 (file)
@@ -23,7 +23,7 @@ unset($array[0]);
 var_dump(reset($array));
 ?>
 ===DONE===
---EXPECT--
+--EXPECTF--
 *** Testing reset() : usage variations ***
 
 -- Initial Position: --
index eaccecc7bc02f5a1312dd6b40a77ba619e163790..31e9706dcde69c7362c70378bc1983af1c72314a 100644 (file)
@@ -39,7 +39,7 @@ echo "\$array2: ";
 var_dump(current($array2));
 ?>
 ===DONE===
---EXPECT--
+--EXPECTF--
 *** Testing reset() : usage variations ***
 
 -- Initial position of internal pointer --
index 4fe4673f83e19233b7b808a39094c02dc64a1815..bd65c43ed3ab57e979966408aa6e0e1e6d0d9606 100644 (file)
@@ -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
index 47dbf4c0bf3df3892e2ba4abf476edd54368ec6c..6f6f2f97620a36be353fa5b968c76903e3aefd1c 100644 (file)
@@ -48,4 +48,4 @@ array(2) {
   [1]=>
   int(2)
 }
-Done
+Done
\ No newline at end of file
index a4999c33cacd04e434ae9a5570e22b9b58c62e09..2db9fb7d4d08855e7b93f8c0f7f04974d802589a 100644 (file)
@@ -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
index fc3683e0b3579f9ebe950e02866b8ec5ecd203e2..8071545ecf8718c868efbda202e176ab308be35c 100644 (file)
@@ -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
index 0abfde64a7568c3c6f37c45b7702a9bc345ce802..05b56e86317e94c657f94e2d57f6af59fa6407e1 100644 (file)
@@ -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
index 2e4a96adba9aed347c6d7279e608789d8ae27aa4..ccf886b0703936632f92badbdeebe3eb694d0984 100644 (file)
@@ -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
index 408c37bd6eb48a329c01d99d09998627ed52ecaa..73daf1712db25e853d1e73b3b12006fbde045dc0 100644 (file)
Binary files a/ext/standard/tests/array/rsort_variation11.phpt and b/ext/standard/tests/array/rsort_variation11.phpt differ
index e546b3f619ba0ad5ba33b2e33055c3831d64ab5f..bf99ee9d71ec47b2dc9558229ea413d438765c92 100644 (file)
@@ -481,4 +481,4 @@ array(5) {
   [4]=>
   int(1)
 }
-Done
+Done
\ No newline at end of file
index ef1fb1085c0523fc7373fa402649c027c4767909..f8c002a6f7885a94db8aa2f9b28ac7990ecc2bcc 100644 (file)
@@ -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
index 1eac39eeff957b7637b2f016a191289ead016070..5e64a4e89535901828b20c561c2fb152cb69a243 100644 (file)
@@ -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
index b74037fc8c310634405379e125be931aff19ec7e..ebd45f4793c22d458db4bb2f014b5a09f0dea1aa 100644 (file)
@@ -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
index 4c27bca1e79fadb9eb0edb23925ab967b21f7183..559a1ebaf70342a891ce73d98bb0a5272e08fe4a 100644 (file)
@@ -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
index 033eedcf9baff750611220c76591030dbab3cba9..a996bf6db34cc18ab483253e4bd5c55101e36baa 100644 (file)
@@ -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
index 923127d98093d8f9fb122534d385291d283cc0e2..a4f94b5f0f39d71c65d2f81669726bbac6c734b3 100644 (file)
@@ -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
index a78c43758e60ac52142a93561abb9d6c328ebe05..dafe3fa09042004ffa564b3ae8bcc509d703e2c7 100644 (file)
@@ -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 (file)
index 0000000..f83c032
--- /dev/null
@@ -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 (file)
index 0000000..6f447e0
--- /dev/null
@@ -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 (file)
index 0000000..4eeb876
--- /dev/null
@@ -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 (file)
index 0000000..daf2cae
--- /dev/null
@@ -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 (file)
index 0000000..fb22bf9
--- /dev/null
@@ -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 (file)
index 0000000..955a561
--- /dev/null
@@ -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 (file)
index 0000000..ab60400
--- /dev/null
@@ -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 (file)
index 0000000..a86bab3
--- /dev/null
@@ -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 (file)
index 0000000..55afb20
--- /dev/null
@@ -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 (file)
index 0000000..af8fa2e
--- /dev/null
@@ -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 (file)
index 0000000..7f8b930
--- /dev/null
@@ -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 (file)
index 0000000..ef140e3
--- /dev/null
@@ -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 (file)
index 0000000..daade03
--- /dev/null
@@ -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 (file)
index 0000000..bf076f6
--- /dev/null
@@ -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 (file)
index 0000000..e191212
--- /dev/null
@@ -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 (file)
index 0000000..f5a554c
--- /dev/null
@@ -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 (file)
index 0000000..84775d7
--- /dev/null
@@ -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 (file)
index 0000000..db92479
--- /dev/null
@@ -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 (file)
index 0000000..d727cf0
--- /dev/null
@@ -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===