1--TEST-- 2Test closedir() function : usage variations - close directory handle twice 3--FILE-- 4<?php 5/* 6 * close the directory handle twice using closedir() to test behaviour 7 */ 8 9echo "*** Testing closedir() : usage variations ***\n"; 10 11//create temporary directory for test, removed in CLEAN section 12$directory = __DIR__ . "/closedir_variation2"; 13mkdir($directory); 14 15$dh = opendir($directory); 16 17echo "\n-- Close directory handle first time: --\n"; 18var_dump(closedir($dh)); 19echo "Directory Handle: "; 20var_dump($dh); 21 22echo "\n-- Close directory handle second time: --\n"; 23try { 24 var_dump(closedir($dh)); 25} catch (TypeError $e) { 26 echo $e->getMessage(), "\n"; 27} 28echo "Directory Handle: "; 29var_dump($dh); 30?> 31--CLEAN-- 32<?php 33$directory = __DIR__ . "/closedir_variation2"; 34rmdir($directory); 35?> 36--EXPECTF-- 37*** Testing closedir() : usage variations *** 38 39-- Close directory handle first time: -- 40NULL 41Directory Handle: resource(%d) of type (Unknown) 42 43-- Close directory handle second time: -- 44closedir(): supplied resource is not a valid Directory resource 45Directory Handle: resource(%d) of type (Unknown) 46