Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ext/standard/tests/url/bug55399.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ Bug #55399 (parse_url() incorrectly treats ':' as a valid path)
var_dump(parse_url(":"));

?>
--EXPECT--
--EXPECTF--
Warning: parse_url(): Trailing colon without port in URL in %s on line %d
bool(false)
70 changes: 52 additions & 18 deletions ext/standard/tests/url/parse_url_basic_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ foreach ($urls as $url) {

echo "Done";
?>
--EXPECT--
--EXPECTF--
--> 64.246.30.37: array(1) {
["path"]=>
string(12) "64.246.30.37"
Expand Down Expand Up @@ -762,7 +762,9 @@ echo "Done";
string(9) "/blah.com"
}

--> x://::abc/?: bool(false)
--> x://::abc/?:
Warning: parse_url(): Invalid port in URL in %s on line %d
bool(false)

--> http://::?: array(3) {
["scheme"]=>
Expand Down Expand Up @@ -791,9 +793,13 @@ echo "Done";
int(6)
}

--> http://?:/: bool(false)
--> http://?:/:
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)

--> http://@?:/: bool(false)
--> http://@?:/:
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)

--> file:///:: array(2) {
["scheme"]=>
Expand Down Expand Up @@ -884,31 +890,59 @@ echo "Done";
string(1) "/"
}

--> http:///blah.com: bool(false)
--> http:///blah.com:
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)

--> http://:80: bool(false)
--> http://:80:
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)

--> http://user@:80: bool(false)
--> http://user@:80:
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)

--> http://user:pass@:80: bool(false)
--> http://user:pass@:80:
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)

--> http://:: bool(false)
--> http://::
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)

--> http://@/: bool(false)
--> http://@/:
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)

--> http://@:/: bool(false)
--> http://@:/:
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)

--> http://:/: bool(false)
--> http://:/:
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)

--> http://?: bool(false)
--> http://?:
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)

--> http://#: bool(false)
--> http://#:
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)

--> http://?:: bool(false)
--> http://?::
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)

--> http://:?: bool(false)
--> http://:?:
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)

--> http://blah.com:123456: bool(false)
--> http://blah.com:123456:
Warning: parse_url(): Port number too long in URL in %s on line %d
bool(false)

--> http://blah.com:abcdef: bool(false)
--> http://blah.com:abcdef:
Warning: parse_url(): Port number too long in URL in %s on line %d
bool(false)
Done
72 changes: 53 additions & 19 deletions ext/standard/tests/url/parse_url_basic_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ foreach ($urls as $url) {

echo "Done";
?>
--EXPECT--
--EXPECTF--
--> 64.246.30.37 : NULL
--> http://64.246.30.37 : string(4) "http"
--> http://64.246.30.37/ : string(4) "http"
Expand Down Expand Up @@ -89,12 +89,18 @@ echo "Done";
--> http://x:? : string(4) "http"
--> x:blah.com : string(1) "x"
--> x:/blah.com : string(1) "x"
--> x://::abc/? : bool(false)
--> x://::abc/? :
Warning: parse_url(): Invalid port in URL in %s on line %d
bool(false)
--> http://::? : string(4) "http"
--> http://::# : string(4) "http"
--> x://::6.5 : string(1) "x"
--> http://?:/ : bool(false)
--> http://@?:/ : bool(false)
--> http://?:/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://@?:/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> file:///: : string(4) "file"
--> file:///a:/ : string(4) "file"
--> file:///ab:/ : string(4) "file"
Expand All @@ -108,18 +114,46 @@ echo "Done";
--> /rest/Users?filter={"id":"123"} : NULL
--> %:x : NULL
--> https://example.com:0/ : string(5) "https"
--> http:///blah.com : bool(false)
--> http://:80 : bool(false)
--> http://user@:80 : bool(false)
--> http://user:pass@:80 : bool(false)
--> http://: : bool(false)
--> http://@/ : bool(false)
--> http://@:/ : bool(false)
--> http://:/ : bool(false)
--> http://? : bool(false)
--> http://# : bool(false)
--> http://?: : bool(false)
--> http://:? : bool(false)
--> http://blah.com:123456 : bool(false)
--> http://blah.com:abcdef : bool(false)
Done
--> http:///blah.com :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://:80 :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://user@:80 :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://user:pass@:80 :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://: :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://@/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://@:/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://:/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://? :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://# :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://?: :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://:? :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://blah.com:123456 :
Warning: parse_url(): Port number too long in URL in %s on line %d
bool(false)
--> http://blah.com:abcdef :
Warning: parse_url(): Port number too long in URL in %s on line %d
bool(false)
Done
70 changes: 52 additions & 18 deletions ext/standard/tests/url/parse_url_basic_003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ foreach ($urls as $url) {

echo "Done";
?>
--EXPECT--
--EXPECTF--
--> 64.246.30.37 : NULL
--> http://64.246.30.37 : string(12) "64.246.30.37"
--> http://64.246.30.37/ : string(12) "64.246.30.37"
Expand Down Expand Up @@ -88,12 +88,18 @@ echo "Done";
--> http://x:? : string(1) "x"
--> x:blah.com : NULL
--> x:/blah.com : NULL
--> x://::abc/? : bool(false)
--> x://::abc/? :
Warning: parse_url(): Invalid port in URL in %s on line %d
bool(false)
--> http://::? : string(1) ":"
--> http://::# : string(1) ":"
--> x://::6.5 : string(1) ":"
--> http://?:/ : bool(false)
--> http://@?:/ : bool(false)
--> http://?:/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://@?:/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> file:///: : NULL
--> file:///a:/ : NULL
--> file:///ab:/ : NULL
Expand All @@ -107,18 +113,46 @@ echo "Done";
--> /rest/Users?filter={"id":"123"} : NULL
--> %:x : NULL
--> https://example.com:0/ : string(11) "example.com"
--> http:///blah.com : bool(false)
--> http://:80 : bool(false)
--> http://user@:80 : bool(false)
--> http://user:pass@:80 : bool(false)
--> http://: : bool(false)
--> http://@/ : bool(false)
--> http://@:/ : bool(false)
--> http://:/ : bool(false)
--> http://? : bool(false)
--> http://# : bool(false)
--> http://?: : bool(false)
--> http://:? : bool(false)
--> http://blah.com:123456 : bool(false)
--> http://blah.com:abcdef : bool(false)
--> http:///blah.com :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://:80 :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://user@:80 :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://user:pass@:80 :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://: :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://@/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://@:/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://:/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://? :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://# :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://?: :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://:? :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://blah.com:123456 :
Warning: parse_url(): Port number too long in URL in %s on line %d
bool(false)
--> http://blah.com:abcdef :
Warning: parse_url(): Port number too long in URL in %s on line %d
bool(false)
Done
70 changes: 52 additions & 18 deletions ext/standard/tests/url/parse_url_basic_004.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ foreach ($urls as $url) {

echo "Done";
?>
--EXPECT--
--EXPECTF--
--> 64.246.30.37 : NULL
--> http://64.246.30.37 : NULL
--> http://64.246.30.37/ : NULL
Expand Down Expand Up @@ -88,12 +88,18 @@ echo "Done";
--> http://x:? : NULL
--> x:blah.com : NULL
--> x:/blah.com : NULL
--> x://::abc/? : bool(false)
--> x://::abc/? :
Warning: parse_url(): Invalid port in URL in %s on line %d
bool(false)
--> http://::? : NULL
--> http://::# : NULL
--> x://::6.5 : int(6)
--> http://?:/ : bool(false)
--> http://@?:/ : bool(false)
--> http://?:/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://@?:/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> file:///: : NULL
--> file:///a:/ : NULL
--> file:///ab:/ : NULL
Expand All @@ -107,18 +113,46 @@ echo "Done";
--> /rest/Users?filter={"id":"123"} : NULL
--> %:x : NULL
--> https://example.com:0/ : int(0)
--> http:///blah.com : bool(false)
--> http://:80 : bool(false)
--> http://user@:80 : bool(false)
--> http://user:pass@:80 : bool(false)
--> http://: : bool(false)
--> http://@/ : bool(false)
--> http://@:/ : bool(false)
--> http://:/ : bool(false)
--> http://? : bool(false)
--> http://# : bool(false)
--> http://?: : bool(false)
--> http://:? : bool(false)
--> http://blah.com:123456 : bool(false)
--> http://blah.com:abcdef : bool(false)
--> http:///blah.com :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://:80 :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://user@:80 :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://user:pass@:80 :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://: :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://@/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://@:/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://:/ :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://? :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://# :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://?: :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://:? :
Warning: parse_url(): Empty host in URL in %s on line %d
bool(false)
--> http://blah.com:123456 :
Warning: parse_url(): Port number too long in URL in %s on line %d
bool(false)
--> http://blah.com:abcdef :
Warning: parse_url(): Port number too long in URL in %s on line %d
bool(false)
Done
Loading
Loading