1--TEST--
2Test array_diff_uassoc() function : error conditions
3--FILE--
4<?php
5echo "*** Testing array_diff_uassoc() : error conditions ***\n";
6
7//Initialize array
8$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
9$array2 = array("a" => "green", "yellow", "red");
10$array3 = array("a" => "green", "red");
11$array4 = array();
12$extra_arg = array(1, 2, 3, 4);
13
14function key_compare_func($a, $b)
15{
16    if ($a === $b) {
17        return 0;
18    }
19    return ($a > $b)? 1:-1;
20}
21
22//Test array_diff_uassoc with one more than the expected number of arguments
23echo "\n-- Testing array_diff_uassoc() function with more than expected no. of arguments --\n";
24try {
25    var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) );
26} catch (TypeError $e) {
27    echo $e->getMessage(), "\n";
28}
29try {
30    var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) );
31} catch (TypeError $e) {
32    echo $e->getMessage(), "\n";
33}
34
35// Testing array_diff_uassoc with one less than the expected number of arguments
36echo "\n-- Testing array_diff_uassoc() function with less than expected no. of arguments --\n";
37try {
38    var_dump( array_diff_uassoc($array1, $array2) );
39} catch (TypeError $e) {
40    echo $e->getMessage(), "\n";
41}
42
43?>
44--EXPECT--
45*** Testing array_diff_uassoc() : error conditions ***
46
47-- Testing array_diff_uassoc() function with more than expected no. of arguments --
48array_diff_uassoc(): Argument #4 must be a valid callback, array callback must have exactly two members
49array_diff_uassoc(): Argument #6 must be a valid callback, array callback must have exactly two members
50
51-- Testing array_diff_uassoc() function with less than expected no. of arguments --
52array_diff_uassoc(): Argument #2 must be a valid callback, array callback must have exactly two members
53