diff --git a/ext/standard/url.c b/ext/standard/url.c index 44a568032b690..c1593228377a8 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -201,6 +201,8 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) STR_FREE(ret->scheme); efree(ret); return NULL; + } else if (*s == '/' && *(s+1) == '/') { /* relative-scheme URL */ + s += 2; } else { goto just_path; } diff --git a/tests/output/bug63162.phpt b/tests/output/bug63162.phpt new file mode 100644 index 0000000000000..103a512fa4556 --- /dev/null +++ b/tests/output/bug63162.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test parse_url() for bug #63162 +--DESCRIPTION-- +This test covers tests the inputs: +[0]=> http://user:pass@host +[1]=> //user:pass@host +[2]=> //user@host +--FILE-- + +--EXPECT-- +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(4) "host" + ["user"]=> + string(4) "user" + ["pass"]=> + string(4) "pass" +} + +array(3) { + ["host"]=> + string(4) "host" + ["user"]=> + string(4) "user" + ["pass"]=> + string(4) "pass" +} + +array(2) { + ["host"]=> + string(4) "host" + ["user"]=> + string(4) "user" +}