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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
--TEST--
Stream: RFC2397 getting meta data
--INI--
allow_url_fopen=1
--FILE--
<?php
$streams = array(
'data://,',
'data://',
'data://;base64,',
'data://;base64',
'data://foo,',
'data://foo=bar,',
'data://text/plain,',
'data://text/plain;foo,',
'data://text/plain;foo=bar,',
'data://text/plain;foo=bar;bla,',
'data://text/plain;foo=bar;base64,',
'data://text/plain;foo=bar;bar=baz',
'data://text/plain;foo=bar;bar=baz,',
);
foreach($streams as $stream)
{
$stream = fopen($stream, 'r');
$meta = @stream_get_meta_data($stream);
var_dump($meta);
var_dump(isset($meta['foo']) ? $meta['foo'] : null);
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
array(7) {
["base64"]=>
bool(false)
["wrapper_type"]=>
string(7) "RFC2397"
["stream_type"]=>
string(7) "RFC2397"
["mode"]=>
string(1) "r"
["unread_bytes"]=>
int(0)
["seekable"]=>
bool(true)
["uri"]=>
string(8) "data://,"
}
NULL
Warning: fopen(data://): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
NULL
NULL
array(7) {
["base64"]=>
bool(true)
["wrapper_type"]=>
string(7) "RFC2397"
["stream_type"]=>
string(7) "RFC2397"
["mode"]=>
string(1) "r"
["unread_bytes"]=>
int(0)
["seekable"]=>
bool(true)
["uri"]=>
string(15) "data://;base64,"
}
NULL
Warning: fopen(data://;base64): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
NULL
NULL
Warning: fopen(data://foo,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d
NULL
NULL
Warning: fopen(data://foo=bar,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d
NULL
NULL
array(8) {
["mediatype"]=>
string(10) "text/plain"
["base64"]=>
bool(false)
["wrapper_type"]=>
string(7) "RFC2397"
["stream_type"]=>
string(7) "RFC2397"
["mode"]=>
string(1) "r"
["unread_bytes"]=>
int(0)
["seekable"]=>
bool(true)
["uri"]=>
string(18) "data://text/plain,"
}
NULL
Warning: fopen(data://text/plain;foo,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d
NULL
NULL
array(9) {
["mediatype"]=>
string(10) "text/plain"
["foo"]=>
string(3) "bar"
["base64"]=>
bool(false)
["wrapper_type"]=>
string(7) "RFC2397"
["stream_type"]=>
string(7) "RFC2397"
["mode"]=>
string(1) "r"
["unread_bytes"]=>
int(0)
["seekable"]=>
bool(true)
["uri"]=>
string(26) "data://text/plain;foo=bar,"
}
string(3) "bar"
Warning: fopen(data://text/plain;foo=bar;bla,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d
NULL
NULL
array(9) {
["mediatype"]=>
string(10) "text/plain"
["foo"]=>
string(3) "bar"
["base64"]=>
bool(true)
["wrapper_type"]=>
string(7) "RFC2397"
["stream_type"]=>
string(7) "RFC2397"
["mode"]=>
string(1) "r"
["unread_bytes"]=>
int(0)
["seekable"]=>
bool(true)
["uri"]=>
string(33) "data://text/plain;foo=bar;base64,"
}
string(3) "bar"
Warning: fopen(data://text/plain;foo=bar;bar=baz): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
NULL
NULL
array(10) {
["mediatype"]=>
string(10) "text/plain"
["foo"]=>
string(3) "bar"
["bar"]=>
string(3) "baz"
["base64"]=>
bool(false)
["wrapper_type"]=>
string(7) "RFC2397"
["stream_type"]=>
string(7) "RFC2397"
["mode"]=>
string(1) "r"
["unread_bytes"]=>
int(0)
["seekable"]=>
bool(true)
["uri"]=>
string(34) "data://text/plain;foo=bar;bar=baz,"
}
string(3) "bar"
===DONE===
|