X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2Fgh-issue48.phpt;fp=tests%2Fgh-issue48.phpt;h=ae12825df0f92119720c12a98b4bf05b0c355e6f;hp=0000000000000000000000000000000000000000;hb=e8ff1c1db343e8862ff436381a9b6ba01a60a4fa;hpb=42f0deb424dd6348d91d09120f015844d832afd6 diff --git a/tests/gh-issue48.phpt b/tests/gh-issue48.phpt new file mode 100644 index 0000000..ae12825 --- /dev/null +++ b/tests/gh-issue48.phpt @@ -0,0 +1,177 @@ +--TEST-- +url errors +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; + } + + echo "# IGNORE\n"; + echo new http\Url($url, null, $flags|http\Url::IGNORE_ERRORS), "\n"; + + echo "# SILENT\n"; + echo new http\Url($url, null, $flags|http\Url::SILENT_ERRORS), "\n"; + + echo "# IGNORE|SILENT\n"; + echo new http\Url($url, null, $flags|http\Url::IGNORE_ERRORS|http\Url::SILENT_ERRORS), "\n"; + echo "==========\n"; +} + +test("http://.foo.bar/?q=1"); +test("http://..foo.bar/i.x"); +test("http://foo..bar/i..x"); +test("http://-foo.bar"); +test("http://--foo.bar"); +test("http://f--oo.bar"); +test("htto://foo.bar/?q=%"); +test("htto://foo.bar/?q=%", http\Url::PARSE_TOPCT); +test("http://a\xc3\xc3b"); +test("http://[foobar]:123"); +test("#/?foo=&#", http\Url::PARSE_MBUTF8); + +?> + +===DONE=== +--EXPECTF-- +Test +# DEFAULT +http\Url::__construct(): Failed to parse host; unexpected '.' at pos 0 in '.foo.bar/?q=1' +# IGNORE + +Warning: http\Url::__construct(): Failed to parse host; unexpected '.' at pos 0 in '.foo.bar/?q=1' in %sgh-issue48.php on line %d +http://foo.bar/?q=1 +# SILENT + +# IGNORE|SILENT +http://foo.bar/?q=1 +========== +# DEFAULT +http\Url::__construct(): Failed to parse host; unexpected '.' at pos 0 in '..foo.bar/i.x' +# IGNORE + +Warning: http\Url::__construct(): Failed to parse host; unexpected '.' at pos 0 in '..foo.bar/i.x' in %sgh-issue48.php on line %d + +Warning: http\Url::__construct(): Failed to parse host; unexpected '.' at pos 1 in '..foo.bar/i.x' in %sgh-issue48.php on line %d +http://foo.bar/i.x +# SILENT + +# IGNORE|SILENT +http://foo.bar/i.x +========== +# DEFAULT +http\Url::__construct(): Failed to parse host; unexpected '.' at pos 4 in 'foo..bar/i..x' +# IGNORE + +Warning: http\Url::__construct(): Failed to parse host; unexpected '.' at pos 4 in 'foo..bar/i..x' in %sgh-issue48.php on line %d +http://foo.bar/i..x +# SILENT + +# IGNORE|SILENT +http://foo.bar/i..x +========== +# DEFAULT +http\Url::__construct(): Failed to parse host; unexpected '-' at pos 0 in '-foo.bar' +# IGNORE + +Warning: http\Url::__construct(): Failed to parse host; unexpected '-' at pos 0 in '-foo.bar' in %sgh-issue48.php on line %d +http://foo.bar/ +# SILENT + +# IGNORE|SILENT +http://foo.bar/ +========== +# DEFAULT +http\Url::__construct(): Failed to parse host; unexpected '-' at pos 0 in '--foo.bar' +# IGNORE + +Warning: http\Url::__construct(): Failed to parse host; unexpected '-' at pos 0 in '--foo.bar' in %sgh-issue48.php on line %d + +Warning: http\Url::__construct(): Failed to parse host; unexpected '-' at pos 1 in '--foo.bar' in %sgh-issue48.php on line %d +http://foo.bar/ +# SILENT + +# IGNORE|SILENT +http://foo.bar/ +========== +# DEFAULT +http://f--oo.bar/ +# IGNORE +http://f--oo.bar/ +# SILENT +http://f--oo.bar/ +# IGNORE|SILENT +http://f--oo.bar/ +========== +# DEFAULT +http\Url::__construct(): Failed to parse query; invalid percent encoding at pos 2 in 'q=%' +# IGNORE + +Warning: http\Url::__construct(): Failed to parse query; invalid percent encoding at pos 2 in 'q=%' in %sgh-issue48.php on line %d +htto://foo.bar/?q=% +# SILENT + +# IGNORE|SILENT +htto://foo.bar/?q=% +========== +# DEFAULT +http\Url::__construct(): Failed to parse query; invalid percent encoding at pos 2 in 'q=%' +# IGNORE + +Warning: http\Url::__construct(): Failed to parse query; invalid percent encoding at pos 2 in 'q=%' in %sgh-issue48.php on line %d +htto://foo.bar/?q=%25 +# SILENT + +# IGNORE|SILENT +htto://foo.bar/?q=%25 +========== +# DEFAULT +http\Url::__construct(): Failed to parse hostinfo; unexpected byte 0xc3 at pos 1 in 'a%c%cb' +# IGNORE + +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 + +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 +http://ab/ +# SILENT + +# IGNORE|SILENT +http://ab/ +========== +# DEFAULT +http\Url::__construct(): Failed to parse hostinfo; unexpected '[' at pos 0 in '[foobar]:123' +# IGNORE + +Warning: http\Url::__construct(): Failed to parse hostinfo; unexpected '[' at pos 0 in '[foobar]:123' in %sgh-issue48.php on line %d + +Warning: http\Url::__construct(): Failed to parse hostinfo; unexpected byte 0x5b at pos 0 in '[foobar]:123' in %sgh-issue48.php on line %d + +Warning: http\Url::__construct(): Failed to parse hostinfo; unexpected byte 0x5d at pos 7 in '[foobar]:123' in %sgh-issue48.php on line %d +http://foobar:123/ +# SILENT + +# IGNORE|SILENT +http://foobar:123/ +========== +# DEFAULT +http\Url::__construct(): Failed to parse fragment; invalid fragment identifier at pos 7 in '/?foo=&#' +# IGNORE + +Warning: http\Url::__construct(): Failed to parse fragment; invalid fragment identifier at pos 7 in '/?foo=&#' in /home/mike/src/ext-http.git/tests/gh-issue48.php on line 13 +#/?foo=&# +# SILENT + +# IGNORE|SILENT +#/?foo=&# +========== + +===DONE===