Return to closedir_variation3.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / dir |
1.1 misho 1: --TEST-- 2: Test 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: 15: echo "*** Testing closedir() : usage variations ***\n"; 16: 17: echo "\n-- Open a file using fopen() --\n"; 18: var_dump($fp = fopen(__FILE__, 'r')); 19: 20: echo "\n-- Try to close the file pointer using closedir() --\n"; 21: var_dump(closedir($fp)); 22: 23: echo "\n-- Check file pointer: --\n"; 24: var_dump($fp); 25: 26: if(is_resource($fp)) { 27: fclose($fp); 28: } 29: ?> 30: ===DONE=== 31: --EXPECTF-- 32: *** Testing closedir() : usage variations *** 33: 34: -- Open a file using fopen() -- 35: resource(%d) of type (stream) 36: 37: -- Try to close the file pointer using closedir() -- 38: 39: Warning: closedir(): %d is not a valid Directory resource in %s on line %d 40: bool(false) 41: 42: -- Check file pointer: -- 43: resource(%d) of type (stream) 44: ===DONE===