Skip to content

Commit 395de1f

Browse files
committed
url parsing: improve error reporting using detailed url_error codes
1 parent a623312 commit 395de1f

1 file changed

Lines changed: 49 additions & 17 deletions

File tree

ext/standard/tests/url/parse_url_unterminated.phpt

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ foreach ($urls as $url) {
2020

2121
echo "Done";
2222
?>
23-
--EXPECT--
23+
--EXPECTF--
2424
--> 64.246.30.37: array(1) {
2525
["path"]=>
2626
string(12) "64.246.30.37"
@@ -799,9 +799,13 @@ bool(false)
799799
int(6)
800800
}
801801

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

804-
--> http://@?:/: bool(false)
806+
--> http://@?:/:
807+
Warning: parse_url(): Empty host in URL in %s on line %d
808+
bool(false)
805809

806810
--> file:///:: array(2) {
807811
["scheme"]=>
@@ -892,31 +896,59 @@ bool(false)
892896
string(1) "/"
893897
}
894898

895-
--> http:///blah.com: bool(false)
899+
--> http:///blah.com:
900+
Warning: parse_url(): Empty host in URL in %s on line %d
901+
bool(false)
896902

897-
--> http://:80: bool(false)
903+
--> http://:80:
904+
Warning: parse_url(): Empty host in URL in %s on line %d
905+
bool(false)
898906

899-
--> http://user@:80: bool(false)
907+
--> http://user@:80:
908+
Warning: parse_url(): Empty host in URL in %s on line %d
909+
bool(false)
900910

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

903-
--> http://:: bool(false)
915+
--> http://::
916+
Warning: parse_url(): Empty host in URL in %s on line %d
917+
bool(false)
904918

905-
--> http://@/: bool(false)
919+
--> http://@/:
920+
Warning: parse_url(): Empty host in URL in %s on line %d
921+
bool(false)
906922

907-
--> http://@:/: bool(false)
923+
--> http://@:/:
924+
Warning: parse_url(): Empty host in URL in %s on line %d
925+
bool(false)
908926

909-
--> http://:/: bool(false)
927+
--> http://:/:
928+
Warning: parse_url(): Empty host in URL in %s on line %d
929+
bool(false)
910930

911-
--> http://?: bool(false)
931+
--> http://?:
932+
Warning: parse_url(): Empty host in URL in %s on line %d
933+
bool(false)
912934

913-
--> http://#: bool(false)
935+
--> http://#:
936+
Warning: parse_url(): Empty host in URL in %s on line %d
937+
bool(false)
914938

915-
--> http://?:: bool(false)
939+
--> http://?::
940+
Warning: parse_url(): Empty host in URL in %s on line %d
941+
bool(false)
916942

917-
--> http://:?: bool(false)
943+
--> http://:?:
944+
Warning: parse_url(): Empty host in URL in %s on line %d
945+
bool(false)
918946

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

921-
--> http://blah.com:abcdef: bool(false)
951+
--> http://blah.com:abcdef:
952+
Warning: parse_url(): Port number too long in URL in %s on line %d
953+
bool(false)
922954
Done

0 commit comments

Comments
 (0)