File tree 3 files changed +30
-2
lines changed
3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 2
2
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3
3
?? ??? 2015, PHP 5.5.24
4
4
5
+ - Core:
6
+ . Fixed bug #68917 (parse_url fails on some partial urls). (Wei Dai)
5
7
6
8
19 Mar 2015, PHP 5.5.23
7
9
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #68917 (parse_url fails on some partial urls)
3
+ --FILE--
4
+ <?php
5
+ print_r (parse_url ('//example.org:81/hi?a=b#c=d ' ));
6
+ print_r (parse_url ('//example.org/hi?a=b#c=d ' ));
7
+ ?>
8
+ --EXPECT--
9
+ Array
10
+ (
11
+ [host] => example.org
12
+ [port] => 81
13
+ [path] => /hi
14
+ [query] => a=b
15
+ [fragment] => c=d
16
+ )
17
+ Array
18
+ (
19
+ [host] => example.org
20
+ [path] => /hi
21
+ [query] => a=b
22
+ [fragment] => c=d
23
+ )
Original file line number Diff line number Diff line change @@ -192,6 +192,9 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
192
192
port = strtol (port_buf , NULL , 10 );
193
193
if (port > 0 && port <= 65535 ) {
194
194
ret -> port = (unsigned short ) port ;
195
+ if (* s == '/' && * (s + 1 ) == '/' ) { /* relative-scheme URL */
196
+ s += 2 ;
197
+ }
195
198
} else {
196
199
STR_FREE (ret -> scheme );
197
200
efree (ret );
@@ -201,12 +204,12 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
201
204
STR_FREE (ret -> scheme );
202
205
efree (ret );
203
206
return NULL ;
204
- } else if (* s == '/' && * (s + 1 ) == '/' ) { /* relative-scheme URL */
207
+ } else if (* s == '/' && * (s + 1 ) == '/' ) { /* relative-scheme URL */
205
208
s += 2 ;
206
209
} else {
207
210
goto just_path ;
208
211
}
209
- } else if (* s == '/' && * (s + 1 ) == '/' ) { /* relative-scheme URL */
212
+ } else if (* s == '/' && * (s + 1 ) == '/' ) { /* relative-scheme URL */
210
213
s += 2 ;
211
214
} else {
212
215
just_path :
You can’t perform that action at this time.
0 commit comments