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