prepare v4.2.5
[m6w6/ext-http] / tests / urlparser004.phpt
1 --TEST--
2 url parser multibyte/locale
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 if (!defined("http\\Url::PARSE_MBLOC") or
7 !utf8locale()) {
8 die("skip need http\\Url::PARSE_MBLOC support and LC_CTYPE=*.UTF-8");
9 }
10 ?>
11 --FILE--
12 <?php
13 echo "Test\n";
14 include "skipif.inc";
15 utf8locale();
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));
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(5) "hƟst"
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(5) "hƟst"
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