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