Merge branch 'R_2_3'
[m6w6/ext-http] / tests / urlparser007.phpt
1 --TEST--
2 url parser multibyte/utf-8/idna
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 if (!defined("http\\Url::PARSE_TOIDN")) {
7 die("skip need http\\Url::PARSE_TOIDN support");
8 }
9 ?>
10 --FILE--
11 <?php
12 echo "Test\n";
13
14 $urls = array(
15 "s\xc3\xa7heme:",
16 "s\xc3\xa7heme://h\xc6\x9fst",
17 "s\xc3\xa7heme://h\xc6\x9fst:23/päth/öf/fıle"
18 );
19
20 foreach ($urls as $url) {
21 printf("\n%s\n", $url);
22 var_dump(new http\Url($url, null, http\Url::PARSE_MBUTF8|http\Url::PARSE_TOIDN));
23 }
24 ?>
25 DONE
26 --EXPECTF--
27 Test
28
29 sçheme:
30 object(http\Url)#%d (8) {
31 ["scheme"]=>
32 string(7) "sçheme"
33 ["user"]=>
34 NULL
35 ["pass"]=>
36 NULL
37 ["host"]=>
38 NULL
39 ["port"]=>
40 NULL
41 ["path"]=>
42 NULL
43 ["query"]=>
44 NULL
45 ["fragment"]=>
46 NULL
47 }
48
49 sçheme://hƟst
50 object(http\Url)#%d (8) {
51 ["scheme"]=>
52 string(7) "sçheme"
53 ["user"]=>
54 NULL
55 ["pass"]=>
56 NULL
57 ["host"]=>
58 string(11) "xn--hst-kwb"
59 ["port"]=>
60 NULL
61 ["path"]=>
62 NULL
63 ["query"]=>
64 NULL
65 ["fragment"]=>
66 NULL
67 }
68
69 sçheme://hƟst:23/päth/öf/fıle
70 object(http\Url)#%d (8) {
71 ["scheme"]=>
72 string(7) "sçheme"
73 ["user"]=>
74 NULL
75 ["pass"]=>
76 NULL
77 ["host"]=>
78 string(11) "xn--hst-kwb"
79 ["port"]=>
80 int(23)
81 ["path"]=>
82 string(16) "/päth/öf/fıle"
83 ["query"]=>
84 NULL
85 ["fragment"]=>
86 NULL
87 }
88 DONE