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