Skip to content

Commit 0cdda05

Browse files
bug #62844; relative URL schemes in parse_url()
1 parent cd18e20 commit 0cdda05

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Test parse_url() function: Checks relative URL schemes (e.g. "//example.com")
3+
--FILE--
4+
<?php
5+
var_dump(parse_url('//example.org'));
6+
--EXPECT--
7+
array(1) {
8+
["host"]=>
9+
string(11) "example.org"
10+
}
11+

ext/standard/url.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
204204
} else {
205205
goto just_path;
206206
}
207+
} else if (*s == '/' && *(s+1) == '/') { /* same-scheme (relative) URL */
208+
s += 2;
207209
} else {
208210
just_path:
209211
ue = s + length;

0 commit comments

Comments
 (0)