1--TEST--
2Test array_intersect_ukey() function : usage variation - Passing class without string to callback (Handling fatal error)
3--FILE--
4<?php
5/* Prototype  : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
6 * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
7 * Source code: ext/standard/array.c
8 */
9
10echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
11
12//Initialise arguments
13$array1 = array('blue'  => 1, 'red'  => 2, 'green'  => 3, 'purple' => 4);
14$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan'   => 8);
15$array3 = array("a"=>"green", "cyan");
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_intersect_ukey($array1, $array2, $value) );
34var_dump( array_intersect_ukey($array1, $array2, $array3, $value) );
35?>
36===DONE===
37--EXPECTF--
38*** Testing array_intersect_uassoc() : usage variation ***
39Error: 2 - array_intersect_ukey() expects parameter 3 to be a valid callback, no array or string given, %s(%d)
40NULL
41Error: 2 - array_intersect_ukey() expects parameter 4 to be a valid callback, no array or string given, %s(%d)
42NULL
43===DONE===