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