fis querystring offset set bug
[m6w6/ext-http] / tests / urlparser003.phpt
1 --TEST--
2 url parser with query
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 ?>
7 --FILE--
8 <?php
9 echo "Test\n";
10
11 $urls = array(
12 "s:?q",
13 "ss:?qq",
14 "s:/?q",
15 "ss:/?qq",
16 "s://?q",
17 "ss://?qq",
18 "s://h?q",
19 "ss://hh?qq",
20 "s://h/p?q",
21 "ss://hh/pp?qq",
22 "s://h:123/p/?q",
23 "ss://hh:123/pp/?qq",
24 );
25
26 foreach ($urls as $url) {
27 printf("\n%s\n", $url);
28 var_dump(new http\Url($url, null, 0));
29 }
30 ?>
31 DONE
32 --EXPECTF--
33 Test
34
35 s:?q
36 object(http\Url)#%d (8) {
37 ["scheme"]=>
38 string(1) "s"
39 ["user"]=>
40 NULL
41 ["pass"]=>
42 NULL
43 ["host"]=>
44 NULL
45 ["port"]=>
46 NULL
47 ["path"]=>
48 NULL
49 ["query"]=>
50 string(1) "q"
51 ["fragment"]=>
52 NULL
53 }
54
55 ss:?qq
56 object(http\Url)#%d (8) {
57 ["scheme"]=>
58 string(2) "ss"
59 ["user"]=>
60 NULL
61 ["pass"]=>
62 NULL
63 ["host"]=>
64 NULL
65 ["port"]=>
66 NULL
67 ["path"]=>
68 NULL
69 ["query"]=>
70 string(2) "qq"
71 ["fragment"]=>
72 NULL
73 }
74
75 s:/?q
76 object(http\Url)#%d (8) {
77 ["scheme"]=>
78 string(1) "s"
79 ["user"]=>
80 NULL
81 ["pass"]=>
82 NULL
83 ["host"]=>
84 NULL
85 ["port"]=>
86 NULL
87 ["path"]=>
88 string(1) "/"
89 ["query"]=>
90 string(1) "q"
91 ["fragment"]=>
92 NULL
93 }
94
95 ss:/?qq
96 object(http\Url)#%d (8) {
97 ["scheme"]=>
98 string(2) "ss"
99 ["user"]=>
100 NULL
101 ["pass"]=>
102 NULL
103 ["host"]=>
104 NULL
105 ["port"]=>
106 NULL
107 ["path"]=>
108 string(1) "/"
109 ["query"]=>
110 string(2) "qq"
111 ["fragment"]=>
112 NULL
113 }
114
115 s://?q
116 object(http\Url)#%d (8) {
117 ["scheme"]=>
118 string(1) "s"
119 ["user"]=>
120 NULL
121 ["pass"]=>
122 NULL
123 ["host"]=>
124 NULL
125 ["port"]=>
126 NULL
127 ["path"]=>
128 NULL
129 ["query"]=>
130 string(1) "q"
131 ["fragment"]=>
132 NULL
133 }
134
135 ss://?qq
136 object(http\Url)#%d (8) {
137 ["scheme"]=>
138 string(2) "ss"
139 ["user"]=>
140 NULL
141 ["pass"]=>
142 NULL
143 ["host"]=>
144 NULL
145 ["port"]=>
146 NULL
147 ["path"]=>
148 NULL
149 ["query"]=>
150 string(2) "qq"
151 ["fragment"]=>
152 NULL
153 }
154
155 s://h?q
156 object(http\Url)#%d (8) {
157 ["scheme"]=>
158 string(1) "s"
159 ["user"]=>
160 NULL
161 ["pass"]=>
162 NULL
163 ["host"]=>
164 string(1) "h"
165 ["port"]=>
166 NULL
167 ["path"]=>
168 NULL
169 ["query"]=>
170 string(1) "q"
171 ["fragment"]=>
172 NULL
173 }
174
175 ss://hh?qq
176 object(http\Url)#%d (8) {
177 ["scheme"]=>
178 string(2) "ss"
179 ["user"]=>
180 NULL
181 ["pass"]=>
182 NULL
183 ["host"]=>
184 string(2) "hh"
185 ["port"]=>
186 NULL
187 ["path"]=>
188 NULL
189 ["query"]=>
190 string(2) "qq"
191 ["fragment"]=>
192 NULL
193 }
194
195 s://h/p?q
196 object(http\Url)#%d (8) {
197 ["scheme"]=>
198 string(1) "s"
199 ["user"]=>
200 NULL
201 ["pass"]=>
202 NULL
203 ["host"]=>
204 string(1) "h"
205 ["port"]=>
206 NULL
207 ["path"]=>
208 string(2) "/p"
209 ["query"]=>
210 string(1) "q"
211 ["fragment"]=>
212 NULL
213 }
214
215 ss://hh/pp?qq
216 object(http\Url)#%d (8) {
217 ["scheme"]=>
218 string(2) "ss"
219 ["user"]=>
220 NULL
221 ["pass"]=>
222 NULL
223 ["host"]=>
224 string(2) "hh"
225 ["port"]=>
226 NULL
227 ["path"]=>
228 string(3) "/pp"
229 ["query"]=>
230 string(2) "qq"
231 ["fragment"]=>
232 NULL
233 }
234
235 s://h:123/p/?q
236 object(http\Url)#%d (8) {
237 ["scheme"]=>
238 string(1) "s"
239 ["user"]=>
240 NULL
241 ["pass"]=>
242 NULL
243 ["host"]=>
244 string(1) "h"
245 ["port"]=>
246 int(123)
247 ["path"]=>
248 string(3) "/p/"
249 ["query"]=>
250 string(1) "q"
251 ["fragment"]=>
252 NULL
253 }
254
255 ss://hh:123/pp/?qq
256 object(http\Url)#%d (8) {
257 ["scheme"]=>
258 string(2) "ss"
259 ["user"]=>
260 NULL
261 ["pass"]=>
262 NULL
263 ["host"]=>
264 string(2) "hh"
265 ["port"]=>
266 int(123)
267 ["path"]=>
268 string(4) "/pp/"
269 ["query"]=>
270 string(2) "qq"
271 ["fragment"]=>
272 NULL
273 }
274 DONE