~ubuntu-branches/ubuntu/hardy/php5/hardy-updates

« back to all changes in this revision

Viewing changes to ext/standard/tests/strings/url_t.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-10-09 03:14:32 UTC
  • Revision ID: james.westby@ubuntu.com-20051009031432-kspik3lobxstafv9
Tags: upstream-5.0.5
ImportĀ upstreamĀ versionĀ 5.0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
parse_url() function
 
3
--FILE--
 
4
<?php
 
5
$sample_urls = array (
 
6
'',
 
7
'64.246.30.37',
 
8
'http://64.246.30.37',
 
9
'http://64.246.30.37/',
 
10
'64.246.30.37/',
 
11
'64.246.30.37:80/',
 
12
'php.net',
 
13
'php.net/',
 
14
'http://php.net',
 
15
'http://php.net/',
 
16
'www.php.net',
 
17
'www.php.net/',
 
18
'http://www.php.net',
 
19
'http://www.php.net/',
 
20
'www.php.net:80',
 
21
'http://www.php.net:80',
 
22
'http://www.php.net:80/',
 
23
'http://www.php.net/index.php',
 
24
'www.php.net/?',
 
25
'www.php.net:80/?',
 
26
'http://www.php.net/?',
 
27
'http://www.php.net:80/?',
 
28
'http://www.php.net:80/index.php',
 
29
'http://www.php.net:80/foo/bar/index.php',
 
30
'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php',
 
31
'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5',
 
32
'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/',
 
33
'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php',
 
34
'http://www.php.net:80/this/../a/../deep/directory',
 
35
'http://www.php.net:80/this/../a/../deep/directory/',
 
36
'http://www.php.net:80/this/is/a/very/deep/directory/../file.php',
 
37
'http://www.php.net:80/index.php',
 
38
'http://www.php.net:80/index.php?',
 
39
'http://www.php.net:80/#foo',
 
40
'http://www.php.net:80/?#',
 
41
'http://www.php.net:80/?test=1',
 
42
'http://www.php.net/?test=1&',
 
43
'http://www.php.net:80/?&',
 
44
'http://www.php.net:80/index.php?test=1&',
 
45
'http://www.php.net/index.php?&',
 
46
'http://www.php.net:80/index.php?foo&',
 
47
'http://www.php.net/index.php?&foo',
 
48
'http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI',
 
49
'www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
 
50
'http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
 
51
'http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
 
52
'http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
 
53
'http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
 
54
'http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
 
55
'http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
 
56
'nntp://news.php.net',
 
57
'ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz',
 
58
'zlib:http://foo@bar',
 
59
'zlib:filename.txt',
 
60
'zlib:/path/to/my/file/file.txt',
 
61
'foo://foo@bar',
 
62
'mailto:me@mydomain.com',
 
63
'/foo.php?a=b&c=d',
 
64
'foo.php?a=b&c=d',
 
65
'http://user:passwd@www.example.com:8080?bar=1&boom=0',
 
66
'file:///path/to/file',
 
67
'file://path/to/file',
 
68
'file:/path/to/file',
 
69
'http://1.2.3.4:/abc.asp?a=1&b=2',
 
70
'http://foo.com#bar',
 
71
'scheme:',
 
72
'foo+bar://baz@bang/bla',
 
73
);
 
74
 
 
75
    foreach ($sample_urls as $url) {
 
76
        var_dump(@parse_url($url));
 
77
    }
 
78
?>
 
79
--EXPECT--
 
80
array(1) {
 
81
  ["path"]=>
 
82
  string(0) ""
 
83
}
 
84
array(1) {
 
85
  ["path"]=>
 
86
  string(12) "64.246.30.37"
 
87
}
 
88
array(2) {
 
89
  ["scheme"]=>
 
90
  string(4) "http"
 
91
  ["host"]=>
 
92
  string(12) "64.246.30.37"
 
93
}
 
94
array(3) {
 
95
  ["scheme"]=>
 
96
  string(4) "http"
 
97
  ["host"]=>
 
98
  string(12) "64.246.30.37"
 
99
  ["path"]=>
 
100
  string(1) "/"
 
101
}
 
102
array(1) {
 
103
  ["path"]=>
 
104
  string(13) "64.246.30.37/"
 
105
}
 
106
array(3) {
 
107
  ["host"]=>
 
108
  string(12) "64.246.30.37"
 
109
  ["port"]=>
 
110
  int(80)
 
111
  ["path"]=>
 
112
  string(1) "/"
 
113
}
 
114
array(1) {
 
115
  ["path"]=>
 
116
  string(7) "php.net"
 
117
}
 
118
array(1) {
 
119
  ["path"]=>
 
120
  string(8) "php.net/"
 
121
}
 
122
array(2) {
 
123
  ["scheme"]=>
 
124
  string(4) "http"
 
125
  ["host"]=>
 
126
  string(7) "php.net"
 
127
}
 
128
array(3) {
 
129
  ["scheme"]=>
 
130
  string(4) "http"
 
131
  ["host"]=>
 
132
  string(7) "php.net"
 
133
  ["path"]=>
 
134
  string(1) "/"
 
135
}
 
136
array(1) {
 
137
  ["path"]=>
 
138
  string(11) "www.php.net"
 
139
}
 
140
array(1) {
 
141
  ["path"]=>
 
142
  string(12) "www.php.net/"
 
143
}
 
144
array(2) {
 
145
  ["scheme"]=>
 
146
  string(4) "http"
 
147
  ["host"]=>
 
148
  string(11) "www.php.net"
 
149
}
 
150
array(3) {
 
151
  ["scheme"]=>
 
152
  string(4) "http"
 
153
  ["host"]=>
 
154
  string(11) "www.php.net"
 
155
  ["path"]=>
 
156
  string(1) "/"
 
157
}
 
158
array(2) {
 
159
  ["host"]=>
 
160
  string(11) "www.php.net"
 
161
  ["port"]=>
 
162
  int(80)
 
163
}
 
164
array(3) {
 
165
  ["scheme"]=>
 
166
  string(4) "http"
 
167
  ["host"]=>
 
168
  string(11) "www.php.net"
 
169
  ["port"]=>
 
170
  int(80)
 
171
}
 
172
array(4) {
 
173
  ["scheme"]=>
 
174
  string(4) "http"
 
175
  ["host"]=>
 
176
  string(11) "www.php.net"
 
177
  ["port"]=>
 
178
  int(80)
 
179
  ["path"]=>
 
180
  string(1) "/"
 
181
}
 
182
array(3) {
 
183
  ["scheme"]=>
 
184
  string(4) "http"
 
185
  ["host"]=>
 
186
  string(11) "www.php.net"
 
187
  ["path"]=>
 
188
  string(10) "/index.php"
 
189
}
 
190
array(1) {
 
191
  ["path"]=>
 
192
  string(12) "www.php.net/"
 
193
}
 
194
array(3) {
 
195
  ["host"]=>
 
196
  string(11) "www.php.net"
 
197
  ["port"]=>
 
198
  int(80)
 
199
  ["path"]=>
 
200
  string(1) "/"
 
201
}
 
202
array(3) {
 
203
  ["scheme"]=>
 
204
  string(4) "http"
 
205
  ["host"]=>
 
206
  string(11) "www.php.net"
 
207
  ["path"]=>
 
208
  string(1) "/"
 
209
}
 
210
array(4) {
 
211
  ["scheme"]=>
 
212
  string(4) "http"
 
213
  ["host"]=>
 
214
  string(11) "www.php.net"
 
215
  ["port"]=>
 
216
  int(80)
 
217
  ["path"]=>
 
218
  string(1) "/"
 
219
}
 
220
array(4) {
 
221
  ["scheme"]=>
 
222
  string(4) "http"
 
223
  ["host"]=>
 
224
  string(11) "www.php.net"
 
225
  ["port"]=>
 
226
  int(80)
 
227
  ["path"]=>
 
228
  string(10) "/index.php"
 
229
}
 
230
array(4) {
 
231
  ["scheme"]=>
 
232
  string(4) "http"
 
233
  ["host"]=>
 
234
  string(11) "www.php.net"
 
235
  ["port"]=>
 
236
  int(80)
 
237
  ["path"]=>
 
238
  string(18) "/foo/bar/index.php"
 
239
}
 
240
array(4) {
 
241
  ["scheme"]=>
 
242
  string(4) "http"
 
243
  ["host"]=>
 
244
  string(11) "www.php.net"
 
245
  ["port"]=>
 
246
  int(80)
 
247
  ["path"]=>
 
248
  string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
 
249
}
 
250
array(5) {
 
251
  ["scheme"]=>
 
252
  string(4) "http"
 
253
  ["host"]=>
 
254
  string(11) "www.php.net"
 
255
  ["port"]=>
 
256
  int(80)
 
257
  ["path"]=>
 
258
  string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
 
259
  ["query"]=>
 
260
  string(37) "lots=1&of=2&parameters=3&too=4&here=5"
 
261
}
 
262
array(4) {
 
263
  ["scheme"]=>
 
264
  string(4) "http"
 
265
  ["host"]=>
 
266
  string(11) "www.php.net"
 
267
  ["port"]=>
 
268
  int(80)
 
269
  ["path"]=>
 
270
  string(45) "/this/is/a/very/deep/directory/structure/and/"
 
271
}
 
272
array(4) {
 
273
  ["scheme"]=>
 
274
  string(4) "http"
 
275
  ["host"]=>
 
276
  string(11) "www.php.net"
 
277
  ["port"]=>
 
278
  int(80)
 
279
  ["path"]=>
 
280
  string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
 
281
}
 
282
array(4) {
 
283
  ["scheme"]=>
 
284
  string(4) "http"
 
285
  ["host"]=>
 
286
  string(11) "www.php.net"
 
287
  ["port"]=>
 
288
  int(80)
 
289
  ["path"]=>
 
290
  string(28) "/this/../a/../deep/directory"
 
291
}
 
292
array(4) {
 
293
  ["scheme"]=>
 
294
  string(4) "http"
 
295
  ["host"]=>
 
296
  string(11) "www.php.net"
 
297
  ["port"]=>
 
298
  int(80)
 
299
  ["path"]=>
 
300
  string(29) "/this/../a/../deep/directory/"
 
301
}
 
302
array(4) {
 
303
  ["scheme"]=>
 
304
  string(4) "http"
 
305
  ["host"]=>
 
306
  string(11) "www.php.net"
 
307
  ["port"]=>
 
308
  int(80)
 
309
  ["path"]=>
 
310
  string(42) "/this/is/a/very/deep/directory/../file.php"
 
311
}
 
312
array(4) {
 
313
  ["scheme"]=>
 
314
  string(4) "http"
 
315
  ["host"]=>
 
316
  string(11) "www.php.net"
 
317
  ["port"]=>
 
318
  int(80)
 
319
  ["path"]=>
 
320
  string(10) "/index.php"
 
321
}
 
322
array(4) {
 
323
  ["scheme"]=>
 
324
  string(4) "http"
 
325
  ["host"]=>
 
326
  string(11) "www.php.net"
 
327
  ["port"]=>
 
328
  int(80)
 
329
  ["path"]=>
 
330
  string(10) "/index.php"
 
331
}
 
332
array(5) {
 
333
  ["scheme"]=>
 
334
  string(4) "http"
 
335
  ["host"]=>
 
336
  string(11) "www.php.net"
 
337
  ["port"]=>
 
338
  int(80)
 
339
  ["path"]=>
 
340
  string(1) "/"
 
341
  ["fragment"]=>
 
342
  string(3) "foo"
 
343
}
 
344
array(4) {
 
345
  ["scheme"]=>
 
346
  string(4) "http"
 
347
  ["host"]=>
 
348
  string(11) "www.php.net"
 
349
  ["port"]=>
 
350
  int(80)
 
351
  ["path"]=>
 
352
  string(1) "/"
 
353
}
 
354
array(5) {
 
355
  ["scheme"]=>
 
356
  string(4) "http"
 
357
  ["host"]=>
 
358
  string(11) "www.php.net"
 
359
  ["port"]=>
 
360
  int(80)
 
361
  ["path"]=>
 
362
  string(1) "/"
 
363
  ["query"]=>
 
364
  string(6) "test=1"
 
365
}
 
366
array(4) {
 
367
  ["scheme"]=>
 
368
  string(4) "http"
 
369
  ["host"]=>
 
370
  string(11) "www.php.net"
 
371
  ["path"]=>
 
372
  string(1) "/"
 
373
  ["query"]=>
 
374
  string(7) "test=1&"
 
375
}
 
376
array(5) {
 
377
  ["scheme"]=>
 
378
  string(4) "http"
 
379
  ["host"]=>
 
380
  string(11) "www.php.net"
 
381
  ["port"]=>
 
382
  int(80)
 
383
  ["path"]=>
 
384
  string(1) "/"
 
385
  ["query"]=>
 
386
  string(1) "&"
 
387
}
 
388
array(5) {
 
389
  ["scheme"]=>
 
390
  string(4) "http"
 
391
  ["host"]=>
 
392
  string(11) "www.php.net"
 
393
  ["port"]=>
 
394
  int(80)
 
395
  ["path"]=>
 
396
  string(10) "/index.php"
 
397
  ["query"]=>
 
398
  string(7) "test=1&"
 
399
}
 
400
array(4) {
 
401
  ["scheme"]=>
 
402
  string(4) "http"
 
403
  ["host"]=>
 
404
  string(11) "www.php.net"
 
405
  ["path"]=>
 
406
  string(10) "/index.php"
 
407
  ["query"]=>
 
408
  string(1) "&"
 
409
}
 
410
array(5) {
 
411
  ["scheme"]=>
 
412
  string(4) "http"
 
413
  ["host"]=>
 
414
  string(11) "www.php.net"
 
415
  ["port"]=>
 
416
  int(80)
 
417
  ["path"]=>
 
418
  string(10) "/index.php"
 
419
  ["query"]=>
 
420
  string(4) "foo&"
 
421
}
 
422
array(4) {
 
423
  ["scheme"]=>
 
424
  string(4) "http"
 
425
  ["host"]=>
 
426
  string(11) "www.php.net"
 
427
  ["path"]=>
 
428
  string(10) "/index.php"
 
429
  ["query"]=>
 
430
  string(4) "&foo"
 
431
}
 
432
array(5) {
 
433
  ["scheme"]=>
 
434
  string(4) "http"
 
435
  ["host"]=>
 
436
  string(11) "www.php.net"
 
437
  ["port"]=>
 
438
  int(80)
 
439
  ["path"]=>
 
440
  string(10) "/index.php"
 
441
  ["query"]=>
 
442
  string(31) "test=1&test2=char&test3=mixesCI"
 
443
}
 
444
array(5) {
 
445
  ["host"]=>
 
446
  string(11) "www.php.net"
 
447
  ["port"]=>
 
448
  int(80)
 
449
  ["path"]=>
 
450
  string(10) "/index.php"
 
451
  ["query"]=>
 
452
  string(31) "test=1&test2=char&test3=mixesCI"
 
453
  ["fragment"]=>
 
454
  string(16) "some_page_ref123"
 
455
}
 
456
array(7) {
 
457
  ["scheme"]=>
 
458
  string(4) "http"
 
459
  ["host"]=>
 
460
  string(11) "www.php.net"
 
461
  ["port"]=>
 
462
  int(80)
 
463
  ["user"]=>
 
464
  string(6) "secret"
 
465
  ["path"]=>
 
466
  string(10) "/index.php"
 
467
  ["query"]=>
 
468
  string(31) "test=1&test2=char&test3=mixesCI"
 
469
  ["fragment"]=>
 
470
  string(16) "some_page_ref123"
 
471
}
 
472
array(6) {
 
473
  ["scheme"]=>
 
474
  string(4) "http"
 
475
  ["host"]=>
 
476
  string(11) "www.php.net"
 
477
  ["user"]=>
 
478
  string(6) "secret"
 
479
  ["path"]=>
 
480
  string(10) "/index.php"
 
481
  ["query"]=>
 
482
  string(31) "test=1&test2=char&test3=mixesCI"
 
483
  ["fragment"]=>
 
484
  string(16) "some_page_ref123"
 
485
}
 
486
array(7) {
 
487
  ["scheme"]=>
 
488
  string(4) "http"
 
489
  ["host"]=>
 
490
  string(11) "www.php.net"
 
491
  ["port"]=>
 
492
  int(80)
 
493
  ["pass"]=>
 
494
  string(7) "hideout"
 
495
  ["path"]=>
 
496
  string(10) "/index.php"
 
497
  ["query"]=>
 
498
  string(31) "test=1&test2=char&test3=mixesCI"
 
499
  ["fragment"]=>
 
500
  string(16) "some_page_ref123"
 
501
}
 
502
array(7) {
 
503
  ["scheme"]=>
 
504
  string(4) "http"
 
505
  ["host"]=>
 
506
  string(11) "www.php.net"
 
507
  ["user"]=>
 
508
  string(6) "secret"
 
509
  ["pass"]=>
 
510
  string(7) "hideout"
 
511
  ["path"]=>
 
512
  string(10) "/index.php"
 
513
  ["query"]=>
 
514
  string(31) "test=1&test2=char&test3=mixesCI"
 
515
  ["fragment"]=>
 
516
  string(16) "some_page_ref123"
 
517
}
 
518
array(7) {
 
519
  ["scheme"]=>
 
520
  string(4) "http"
 
521
  ["host"]=>
 
522
  string(19) "hideout@www.php.net"
 
523
  ["port"]=>
 
524
  int(80)
 
525
  ["user"]=>
 
526
  string(6) "secret"
 
527
  ["path"]=>
 
528
  string(10) "/index.php"
 
529
  ["query"]=>
 
530
  string(31) "test=1&test2=char&test3=mixesCI"
 
531
  ["fragment"]=>
 
532
  string(16) "some_page_ref123"
 
533
}
 
534
array(8) {
 
535
  ["scheme"]=>
 
536
  string(4) "http"
 
537
  ["host"]=>
 
538
  string(11) "www.php.net"
 
539
  ["port"]=>
 
540
  int(80)
 
541
  ["user"]=>
 
542
  string(6) "secret"
 
543
  ["pass"]=>
 
544
  string(7) "hid:out"
 
545
  ["path"]=>
 
546
  string(10) "/index.php"
 
547
  ["query"]=>
 
548
  string(31) "test=1&test2=char&test3=mixesCI"
 
549
  ["fragment"]=>
 
550
  string(16) "some_page_ref123"
 
551
}
 
552
array(2) {
 
553
  ["scheme"]=>
 
554
  string(4) "nntp"
 
555
  ["host"]=>
 
556
  string(12) "news.php.net"
 
557
}
 
558
array(3) {
 
559
  ["scheme"]=>
 
560
  string(3) "ftp"
 
561
  ["host"]=>
 
562
  string(11) "ftp.gnu.org"
 
563
  ["path"]=>
 
564
  string(22) "/gnu/glic/glibc.tar.gz"
 
565
}
 
566
array(2) {
 
567
  ["scheme"]=>
 
568
  string(4) "zlib"
 
569
  ["path"]=>
 
570
  string(14) "http://foo@bar"
 
571
}
 
572
array(2) {
 
573
  ["scheme"]=>
 
574
  string(4) "zlib"
 
575
  ["path"]=>
 
576
  string(12) "filename.txt"
 
577
}
 
578
array(2) {
 
579
  ["scheme"]=>
 
580
  string(4) "zlib"
 
581
  ["path"]=>
 
582
  string(25) "/path/to/my/file/file.txt"
 
583
}
 
584
array(3) {
 
585
  ["scheme"]=>
 
586
  string(3) "foo"
 
587
  ["host"]=>
 
588
  string(3) "bar"
 
589
  ["user"]=>
 
590
  string(3) "foo"
 
591
}
 
592
array(2) {
 
593
  ["scheme"]=>
 
594
  string(6) "mailto"
 
595
  ["path"]=>
 
596
  string(15) "me@mydomain.com"
 
597
}
 
598
array(2) {
 
599
  ["path"]=>
 
600
  string(8) "/foo.php"
 
601
  ["query"]=>
 
602
  string(7) "a=b&c=d"
 
603
}
 
604
array(2) {
 
605
  ["path"]=>
 
606
  string(7) "foo.php"
 
607
  ["query"]=>
 
608
  string(7) "a=b&c=d"
 
609
}
 
610
array(6) {
 
611
  ["scheme"]=>
 
612
  string(4) "http"
 
613
  ["host"]=>
 
614
  string(15) "www.example.com"
 
615
  ["port"]=>
 
616
  int(8080)
 
617
  ["user"]=>
 
618
  string(4) "user"
 
619
  ["pass"]=>
 
620
  string(6) "passwd"
 
621
  ["query"]=>
 
622
  string(12) "bar=1&boom=0"
 
623
}
 
624
array(2) {
 
625
  ["scheme"]=>
 
626
  string(4) "file"
 
627
  ["path"]=>
 
628
  string(13) "/path/to/file"
 
629
}
 
630
array(3) {
 
631
  ["scheme"]=>
 
632
  string(4) "file"
 
633
  ["host"]=>
 
634
  string(4) "path"
 
635
  ["path"]=>
 
636
  string(8) "/to/file"
 
637
}
 
638
array(2) {
 
639
  ["scheme"]=>
 
640
  string(4) "file"
 
641
  ["path"]=>
 
642
  string(13) "/path/to/file"
 
643
}
 
644
array(4) {
 
645
  ["scheme"]=>
 
646
  string(4) "http"
 
647
  ["host"]=>
 
648
  string(7) "1.2.3.4"
 
649
  ["path"]=>
 
650
  string(8) "/abc.asp"
 
651
  ["query"]=>
 
652
  string(7) "a=1&b=2"
 
653
}
 
654
array(3) {
 
655
  ["scheme"]=>
 
656
  string(4) "http"
 
657
  ["host"]=>
 
658
  string(7) "foo.com"
 
659
  ["fragment"]=>
 
660
  string(3) "bar"
 
661
}
 
662
array(1) {
 
663
  ["scheme"]=>
 
664
  string(6) "scheme"
 
665
}
 
666
array(4) {
 
667
  ["scheme"]=>
 
668
  string(7) "foo+bar"
 
669
  ["host"]=>
 
670
  string(4) "bang"
 
671
  ["user"]=>
 
672
  string(3) "baz"
 
673
  ["path"]=>
 
674
  string(4) "/bla"
 
675
}