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