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