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