1--TEST--
2Test array_diff_ukey() function : usage variation - Passing class without string to callback (Handling fatal error)
3--FILE--
4<?php
5/* Prototype  : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
6 * 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.
7 * Source code: ext/standard/array.c
8 */
9
10echo "*** Testing array_diff_ukey() : usage variation ***\n";
11
12// Initialise function arguments not being substituted (if any)
13$array1 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan'   => 8);
14$array2 = array('blue'  => 1, 'red'  => 2, 'green'  => 3, 'purple' => 4);
15$array3 = array(1, 2, 3, 4, 5);
16
17// Define error handler
18function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
19        if (error_reporting() != 0) {
20                // report non-silenced errors
21                echo "Error: $err_no - $err_msg, $filename($linenum)\n";
22        }
23}
24set_error_handler('test_error_handler');
25
26
27class classWithoutToString
28{
29}
30
31$value = new classWithoutToString();
32
33var_dump( array_diff_ukey($array1, $array2, $value) );
34var_dump( array_diff_ukey($array1, $array2, $array3, $value) );
35
36?>
37===DONE===
38--EXPECTF--
39*** Testing array_diff_ukey() : usage variation ***
40Error: 2 - array_diff_ukey() expects parameter 3 to be a valid callback, no array or string given, %s(%d)
41NULL
42Error: 2 - array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given, %s(%d)
43NULL
44===DONE===
45