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