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