fix for changed shutdown order in PHP-7.4
[m6w6/ext-http] / tests / urlparser008.phpt
1 --TEST--
2 url parser ipv6
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 ?>
7 --FILE--
8 <?php
9 echo "Test\n";
10
11 $urls = array(
12 "s://[a:80",
13 "s://[0]",
14 "s://[::1]:80",
15 "s://mike@[0:0:0:0:0:FFFF:204.152.189.116]/foo",
16 );
17
18 foreach ($urls as $url) {
19 try {
20 printf("\n%s\n", $url);
21 var_dump(new http\Url($url, null, 0));
22 } catch (Exception $e) {
23 echo $e->getMessage(),"\n";
24 }
25 }
26 ?>
27 DONE
28 --EXPECTF--
29 Test
30
31 s://[a:80
32 http\Url::__construct(): Failed to parse hostinfo; expected ']' at pos 5 in '[a:80'
33
34 s://[0]
35 http\Url::__construct(): Failed to parse hostinfo; unexpected '[' at pos 0 in '[0]'
36
37 s://[::1]:80
38 object(http\Url)#%d (8) {
39 ["scheme"]=>
40 string(1) "s"
41 ["user"]=>
42 NULL
43 ["pass"]=>
44 NULL
45 ["host"]=>
46 string(5) "[::1]"
47 ["port"]=>
48 int(80)
49 ["path"]=>
50 NULL
51 ["query"]=>
52 NULL
53 ["fragment"]=>
54 NULL
55 }
56
57 s://mike@[0:0:0:0:0:FFFF:204.152.189.116]/foo
58 object(http\Url)#%d (8) {
59 ["scheme"]=>
60 string(1) "s"
61 ["user"]=>
62 string(4) "mike"
63 ["pass"]=>
64 NULL
65 ["host"]=>
66 string(24) "[::ffff:204.152.189.116]"
67 ["port"]=>
68 NULL
69 ["path"]=>
70 string(4) "/foo"
71 ["query"]=>
72 NULL
73 ["fragment"]=>
74 NULL
75 }
76 DONE