1--TEST--
2stream_get_meta_data() with a relative file path
3--FILE--
4<?php
5
6echo "Create a file:\n";
7$filename = __FILE__ . '.tmp';
8$fp = fopen('File://' . $filename, 'w+');
9
10var_dump(stream_get_meta_data($fp));
11
12fclose($fp);
13
14echo "\nChange to file's directory and open with a relative path:\n";
15
16$dirname = dirname($filename);
17chdir($dirname);
18$relative_filename = basename($filename);
19
20$fp = fopen($relative_filename, 'r');
21var_dump(stream_get_meta_data($fp));
22
23fclose($fp);
24
25unlink($filename);
26
27?>
28--EXPECTF--
29Create a file:
30array(9) {
31  ["timed_out"]=>
32  bool(false)
33  ["blocked"]=>
34  bool(true)
35  ["eof"]=>
36  bool(false)
37  ["wrapper_type"]=>
38  string(9) "plainfile"
39  ["stream_type"]=>
40  string(5) "STDIO"
41  ["mode"]=>
42  string(2) "w+"
43  ["unread_bytes"]=>
44  int(0)
45  ["seekable"]=>
46  bool(true)
47  ["uri"]=>
48  string(%i) "File://%sstream_get_meta_data_file_variation4.php.tmp"
49}
50
51Change to file's directory and open with a relative path:
52array(9) {
53  ["timed_out"]=>
54  bool(false)
55  ["blocked"]=>
56  bool(true)
57  ["eof"]=>
58  bool(false)
59  ["wrapper_type"]=>
60  string(9) "plainfile"
61  ["stream_type"]=>
62  string(5) "STDIO"
63  ["mode"]=>
64  string(1) "r"
65  ["unread_bytes"]=>
66  int(0)
67  ["seekable"]=>
68  bool(true)
69  ["uri"]=>
70  string(%i) "stream_get_meta_data_file_variation4.php.tmp"
71}
72