blob: 0f50c1db03716db232137aaf3232a5c136718dbf (
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
|
--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";
try {
var_dump(closedir($fp));
} catch (\TypeError $e) {
echo $e->getMessage() . "\n";
}
echo "\n-- Check file pointer: --\n";
var_dump($fp);
if(is_resource($fp)) {
fclose($fp);
}
?>
--EXPECTF--
*** Testing closedir() : usage variations ***
-- Open a file using fopen() --
resource(%d) of type (stream)
-- Try to close the file pointer using closedir() --
closedir(): Argument #1 ($dir_handle) must be a valid Directory resource
-- Check file pointer: --
resource(%d) of type (stream)
|