1--TEST-- 2Test closedir() function : usage variations - close directory handle twice 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 : void closedir([resource $dir_handle]) 12 * Description: Close directory connection identified by the dir_handle 13 * Source code: ext/standard/dir.c 14 * Alias to functions: close 15 */ 16 17/* 18 * close the directory handle twice using closedir() to test behaviour 19 */ 20 21echo "*** Testing closedir() : usage variations ***\n"; 22 23//create temporary directory for test, removed in CLEAN section 24$directory = dirname(__FILE__) . "/私はガラスを食べられますclosedir_variation2"; 25mkdir($directory); 26 27$dh = opendir($directory); 28 29echo "\n-- Close directory handle first time: --\n"; 30var_dump(closedir($dh)); 31echo "Directory Handle: "; 32var_dump($dh); 33 34echo "\n-- Close directory handle second time: --\n"; 35var_dump(closedir($dh)); 36echo "Directory Handle: "; 37var_dump($dh); 38?> 39===DONE=== 40--CLEAN-- 41<?php 42$directory = dirname(__FILE__) . "/私はガラスを食べられますclosedir_variation2"; 43rmdir($directory); 44?> 45--EXPECTF-- 46*** Testing closedir() : usage variations *** 47 48-- Close directory handle first time: -- 49NULL 50Directory Handle: resource(%d) of type (Unknown) 51 52-- Close directory handle second time: -- 53 54Warning: closedir(): %s is not a valid Directory resource in %s on line %d 55bool(false) 56Directory Handle: resource(%d) of type (Unknown) 57===DONE=== 58