11 function test($url, $flags = 0) {
14 echo new http\Url($url, null, $flags), "\n";
15 } catch (Exception $e) {
16 echo $e->getMessage(), "\n";
20 echo new http\Url($url, null, $flags|http\Url::IGNORE_ERRORS), "\n";
23 echo new http\Url($url, null, $flags|http\Url::SILENT_ERRORS), "\n";
25 echo "# IGNORE|SILENT\n";
26 echo new http\Url($url, null, $flags|http\Url::IGNORE_ERRORS|http\Url::SILENT_ERRORS), "\n";
30 test("http://.foo.bar/?q=1");
31 test("http://..foo.bar/i.x");
32 test("http://foo..bar/i..x");
33 test("http://-foo.bar");
34 test("http://--foo.bar");
35 test("http://f--oo.bar");
36 test("htto://foo.bar/?q=%");
37 test("htto://foo.bar/?q=%", http\Url::PARSE_TOPCT);
38 test("http://a\xc3\xc3b");
39 test("http://[foobar]:123");
40 test("#/?foo=&#", http\Url::PARSE_MBUTF8);
48 http\Url::__construct(): Failed to parse host; unexpected '.' at pos 0 in '.foo.bar/?q=1'
51 Warning: http\Url::__construct(): Failed to parse host; unexpected '.' at pos 0 in '.foo.bar/?q=1' in %sgh-issue48.php on line %d
59 http\Url::__construct(): Failed to parse host; unexpected '.' at pos 0 in '..foo.bar/i.x'
62 Warning: http\Url::__construct(): Failed to parse host; unexpected '.' at pos 0 in '..foo.bar/i.x' in %sgh-issue48.php on line %d
64 Warning: http\Url::__construct(): Failed to parse host; unexpected '.' at pos 1 in '..foo.bar/i.x' in %sgh-issue48.php on line %d
72 http\Url::__construct(): Failed to parse host; unexpected '.' at pos 4 in 'foo..bar/i..x'
75 Warning: http\Url::__construct(): Failed to parse host; unexpected '.' at pos 4 in 'foo..bar/i..x' in %sgh-issue48.php on line %d
83 http\Url::__construct(): Failed to parse host; unexpected '-' at pos 0 in '-foo.bar'
86 Warning: http\Url::__construct(): Failed to parse host; unexpected '-' at pos 0 in '-foo.bar' in %sgh-issue48.php on line %d
94 http\Url::__construct(): Failed to parse host; unexpected '-' at pos 0 in '--foo.bar'
97 Warning: http\Url::__construct(): Failed to parse host; unexpected '-' at pos 0 in '--foo.bar' in %sgh-issue48.php on line %d
99 Warning: http\Url::__construct(): Failed to parse host; unexpected '-' at pos 1 in '--foo.bar' in %sgh-issue48.php on line %d
116 http\Url::__construct(): Failed to parse query; invalid percent encoding at pos 2 in 'q=%'
119 Warning: http\Url::__construct(): Failed to parse query; invalid percent encoding at pos 2 in 'q=%' in %sgh-issue48.php on line %d
127 http\Url::__construct(): Failed to parse query; invalid percent encoding at pos 2 in 'q=%'
130 Warning: http\Url::__construct(): Failed to parse query; invalid percent encoding at pos 2 in 'q=%' in %sgh-issue48.php on line %d
131 htto://foo.bar/?q=%25
135 htto://foo.bar/?q=%25
138 http\Url::__construct(): Failed to parse hostinfo; unexpected byte 0xc3 at pos 1 in 'a%c%cb'
141 Warning: http\Url::__construct(): Failed to parse hostinfo; unexpected byte 0xc3 at pos 1 in 'a%c%cb' in %sgh-issue48.php on line %d
143 Warning: http\Url::__construct(): Failed to parse hostinfo; unexpected byte 0xc3 at pos 2 in 'a%c%cb' in %sgh-issue48.php on line %d
151 http\Url::__construct(): Failed to parse hostinfo; unexpected '[' at pos 0 in '[foobar]:123'
154 Warning: http\Url::__construct(): Failed to parse hostinfo; unexpected '[' at pos 0 in '[foobar]:123' in %sgh-issue48.php on line %d
156 Warning: http\Url::__construct(): Failed to parse hostinfo; unexpected byte 0x5b at pos 0 in '[foobar]:123' in %sgh-issue48.php on line %d
158 Warning: http\Url::__construct(): Failed to parse hostinfo; unexpected byte 0x5d at pos 7 in '[foobar]:123' in %sgh-issue48.php on line %d
166 http\Url::__construct(): Failed to parse fragment; invalid fragment identifier at pos 7 in '/?foo=&#'
169 Warning: http\Url::__construct(): Failed to parse fragment; invalid fragment identifier at pos 7 in '/?foo=&#' in %sgh-issue48.php on line %d