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