1--TEST--
2Test rsort() function : error conditions - Pass incorrect number of args
3--FILE--
4<?php
5/* Prototype  : bool rsort(array &$array_arg [, int $sort_flags])
6 * Description: Sort an array in reverse order
7 * Source code: ext/standard/array.c
8 */
9
10/*
11 * Pass incorrect number of arguments to rsort() to test behaviour
12 */
13
14echo "*** Testing rsort() : error conditions ***\n";
15
16// zero arguments
17echo "\n-- Testing rsort() function with Zero arguments --\n";
18var_dump( rsort() );
19
20//Test rsort() with more than the expected number of arguments
21echo "\n-- Testing rsort() function with more than expected no. of arguments --\n";
22$array_arg = array(1, 2);
23$sort_flags = SORT_REGULAR;
24$extra_arg = 10;
25var_dump( rsort($array_arg, $sort_flags, $extra_arg) );
26
27// dump the input array to ensure that it wasn't changed
28var_dump($array_arg);
29
30echo "Done";
31?>
32
33--EXPECTF--
34*** Testing rsort() : error conditions ***
35
36-- Testing rsort() function with Zero arguments --
37
38Warning: rsort() expects at least 1 parameter, 0 given in %s on line %d
39bool(false)
40
41-- Testing rsort() function with more than expected no. of arguments --
42
43Warning: rsort() expects at most 2 parameters, 3 given in %s on line %d
44bool(false)
45array(2) {
46  [0]=>
47  int(1)
48  [1]=>
49  int(2)
50}
51Done