1--TEST-- 2Test closedir() function : usage variations - close a file pointer 3--FILE-- 4<?php 5/* Prototype : void closedir([resource $dir_handle]) 6 * Description: Close directory connection identified by the dir_handle 7 * Source code: ext/standard/dir.c 8 * Alias to functions: close 9 */ 10 11/* 12 * Create a file pointer using fopen() then try to close it using closedir() 13 */ 14 15echo "*** Testing closedir() : usage variations ***\n"; 16 17echo "\n-- Open a file using fopen() --\n"; 18var_dump($fp = fopen(__FILE__, 'r')); 19 20echo "\n-- Try to close the file pointer using closedir() --\n"; 21var_dump(closedir($fp)); 22 23echo "\n-- Check file pointer: --\n"; 24var_dump($fp); 25 26if(is_resource($fp)) { 27 fclose($fp); 28} 29?> 30===DONE=== 31--EXPECTF-- 32*** Testing closedir() : usage variations *** 33 34-- Open a file using fopen() -- 35resource(%d) of type (stream) 36 37-- Try to close the file pointer using closedir() -- 38 39Warning: closedir(): %d is not a valid Directory resource in %s on line %d 40bool(false) 41 42-- Check file pointer: -- 43resource(%d) of type (stream) 44===DONE=== 45