1--TEST--
2Test scandir() function : error conditions - Incorrect number of args
3--FILE--
4<?php
5/* Prototype  : array scandir(string $dir [, int $sorting_order [, resource $context]])
6 * Description: List files & directories inside the specified path
7 * Source code: ext/standard/dir.c
8 */
9
10/*
11 * Pass incorrect number of arguments to scandir() to test behaviour
12 */
13
14echo "*** Testing scandir() : error conditions ***\n";
15
16// Zero arguments
17echo "\n-- Testing scandir() function with Zero arguments --\n";
18var_dump( scandir() );
19
20//Test scandir with one more than the expected number of arguments
21echo "\n-- Testing scandir() function with more than expected no. of arguments --\n";
22$dir = dirname(__FILE__) . '/scandir_error';
23mkdir($dir);
24$sorting_order = 10;
25$context = stream_context_create();
26$extra_arg = 10;
27var_dump( scandir($dir, $sorting_order, $context, $extra_arg) );
28?>
29===DONE===
30--CLEAN--
31<?php
32$directory = dirname(__FILE__) . '/scandir_error';
33rmdir($directory);
34?>
35--EXPECTF--
36*** Testing scandir() : error conditions ***
37
38-- Testing scandir() function with Zero arguments --
39
40Warning: scandir() expects at least 1 parameter, 0 given in %s on line %d
41NULL
42
43-- Testing scandir() function with more than expected no. of arguments --
44
45Warning: scandir() expects at most 3 parameters, 4 given in %s on line %d
46NULL
47===DONE===
48