1--TEST-- 2Test array_uintersect_uassoc() function : usage variation - incorrect callbacks 3--FILE-- 4<?php 5/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func) 6 * 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. 7 * Source code: ext/standard/array.c 8 * Alias to functions: 9 */ 10 11echo "*** Testing array_uintersect_uassoc() : usage variation - incorrect callbacks ***\n"; 12 13$arr1 = array(1); 14$arr2 = array(1,2); 15 16echo "\n-- comparison function with an incorrect return value --\n"; 17function incorrect_return_value ($val1, $val2) { 18 return array(1); 19} 20var_dump(array_uintersect_uassoc($arr1, $arr2, 'incorrect_return_value', 'incorrect_return_value')); 21 22echo "\n-- comparison function taking too many parameters --\n"; 23function too_many_parameters ($val1, $val2, $val3) { 24 return 1; 25} 26var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters')); 27 28echo "\n-- comparison function taking too few parameters --\n"; 29function too_few_parameters ($val1) { 30 return 1; 31} 32var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_few_parameters', 'too_few_parameters')); 33 34?> 35===DONE=== 36--EXPECTF-- 37*** Testing array_uintersect_uassoc() : usage variation - incorrect callbacks *** 38 39-- comparison function with an incorrect return value -- 40array(0) { 41} 42 43-- comparison function taking too many parameters -- 44 45Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_uassoc_variation6.php on line %d 46 47Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_uassoc_variation6.php on line %d 48 49Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_uassoc_variation6.php on line %d 50array(0) { 51} 52 53-- comparison function taking too few parameters -- 54array(0) { 55} 56===DONE=== 57