1--TEST--
2Test array_walk_recursive() function : error conditions
3--FILE--
4<?php
5/* Prototype  : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
6 * Description: Apply a user function to every member of an array
7 * Source code: ext/standard/array.c
8*/
9
10$input = array(1, 2);
11
12/* Prototype : callback(mixed value, mixed key, mixed user_data)
13 * Parameters : value - value in key/value pair
14 *              key - key in key/value pair
15 *              user_data - extra parameter
16 */
17function callback ($value, $key, $user_data) {
18  echo "\ncallback() invoked \n";
19}
20
21echo "*** Testing array_walk_recursive() : error conditions ***\n";
22
23echo "-- Testing array_walk_recursive() function with zero arguments --\n";
24var_dump( array_walk_recursive() );
25
26echo "-- Testing array_walk_recursive() function with one argument --\n";
27var_dump( array_walk_recursive($input) );
28
29$input = array( array(1, 2), array(3), array(4, 5));
30echo "-- Testing array_walk_recursive() function with non existent callback function  --\n";
31var_dump( array_walk_recursive($input, "non_existent") );
32
33echo "Done";
34?>
35--EXPECTF--
36*** Testing array_walk_recursive() : error conditions ***
37-- Testing array_walk_recursive() function with zero arguments --
38
39Warning: array_walk_recursive() expects at least 2 parameters, 0 given in %s on line %d
40NULL
41-- Testing array_walk_recursive() function with one argument --
42
43Warning: array_walk_recursive() expects at least 2 parameters, 1 given in %s on line %d
44NULL
45-- Testing array_walk_recursive() function with non existent callback function  --
46
47Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function 'non_existent' not found or invalid function name in %s on line %d
48NULL
49Done
50