File tree Expand file tree Collapse file tree 3 files changed +46
-1
lines changed Expand file tree Collapse file tree 3 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 2
2
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3
3
?? ??? 2017 PHP 7.0.22
4
4
5
-
5
+ - Core:
6
+ . Fixed bug #74780 (parse_url() borken when query string contains colon).
7
+ (jhdxr)
6
8
7
9
06 Jul 2017 PHP 7.0.21
8
10
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #74780 parse_url() borks when query string contains colon
3
+ --FILE--
4
+ <?php
5
+ var_dump (
6
+ parse_url ('//php.net/path?query=1:2 ' ),
7
+ parse_url ('//php.net/path.php?query=a:b ' ),
8
+ parse_url ('//username@php.net/path?query=1:2 ' )
9
+ );
10
+
11
+ ?>
12
+ --EXPECT--
13
+ array(3) {
14
+ ["host"]=>
15
+ string(7) "php.net"
16
+ ["path"]=>
17
+ string(5) "/path"
18
+ ["query"]=>
19
+ string(9) "query=1:2"
20
+ }
21
+ array(3) {
22
+ ["host"]=>
23
+ string(7) "php.net"
24
+ ["path"]=>
25
+ string(9) "/path.php"
26
+ ["query"]=>
27
+ string(9) "query=a:b"
28
+ }
29
+ array(4) {
30
+ ["host"]=>
31
+ string(7) "php.net"
32
+ ["user"]=>
33
+ string(8) "username"
34
+ ["path"]=>
35
+ string(5) "/path"
36
+ ["query"]=>
37
+ string(9) "query=1:2"
38
+ }
Original file line number Diff line number Diff line change @@ -112,6 +112,10 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length)
112
112
if (!isalpha (* p ) && !isdigit (* p ) && * p != '+' && * p != '.' && * p != '-' ) {
113
113
if (e + 1 < ue && e < s + strcspn (s , "?#" )) {
114
114
goto parse_port ;
115
+ } else if (s + 1 < ue && * s == '/' && * (s + 1 ) == '/' ) { /* relative-scheme URL */
116
+ s += 2 ;
117
+ e = 0 ;
118
+ goto parse_host ;
115
119
} else {
116
120
goto just_path ;
117
121
}
@@ -208,6 +212,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length)
208
212
goto just_path ;
209
213
}
210
214
215
+ parse_host :
211
216
/* Binary-safe strcspn(s, "/?#") */
212
217
e = ue ;
213
218
if ((p = memchr (s , '/' , e - s ))) {
You can’t perform that action at this time.
0 commit comments