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