1--TEST--
2Test array_uintersect_uassoc() function : usage variation - incorrect callbacks
3--FILE--
4<?php
5echo "*** Testing array_uintersect_uassoc() : usage variation - incorrect callbacks ***\n";
6
7$arr1 = array(1);
8$arr2 = array(1,2);
9
10echo "\n-- comparison function with an incorrect return value --\n";
11function incorrect_return_value ($val1, $val2) {
12  return array(1);
13}
14var_dump(array_uintersect_uassoc($arr1, $arr2, 'incorrect_return_value', 'incorrect_return_value'));
15
16echo "\n-- comparison function taking too many parameters --\n";
17function too_many_parameters ($val1, $val2, $val3) {
18  return 1;
19}
20try {
21    var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters'));
22} catch (Throwable $e) {
23    echo "Exception: " . $e->getMessage() . "\n";
24}
25
26echo "\n-- comparison function taking too few parameters --\n";
27function too_few_parameters ($val1) {
28  return 1;
29}
30var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_few_parameters', 'too_few_parameters'));
31
32?>
33--EXPECT--
34*** Testing array_uintersect_uassoc() : usage variation - incorrect callbacks ***
35
36-- comparison function with an incorrect return value --
37array(0) {
38}
39
40-- comparison function taking too many parameters --
41Exception: Too few arguments to function too_many_parameters(), 2 passed and exactly 3 expected
42
43-- comparison function taking too few parameters --
44array(0) {
45}
46