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