summaryrefslogtreecommitdiff
path: root/ext/standard/url.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-04-25 23:47:37 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-04-25 23:47:37 +0000
commit8281f41f3e7880476b6266401965ea55eee7197c (patch)
tree70c06d50ea75d3429ee7113788a1f2500b95324e /ext/standard/url.c
parent87fc464c6b7a5fca297ab4b948a6f2da8680deb3 (diff)
downloadphp-git-8281f41f3e7880476b6266401965ea55eee7197c.tar.gz
Fixed bug #32813 (parse_url() does not handle scheme-only urls properly).
Diffstat (limited to 'ext/standard/url.c')
-rw-r--r--ext/standard/url.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 1c2091f9fe..63c5f60dd5 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -104,6 +104,12 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
/* parse scheme */
if ((e = memchr(s, ':', length)) && (e - s)) {
+ if (*(e + 1) == '\0') { /* only scheme is available */
+ ret->scheme = estrndup(s, (e - s));
+ php_replace_controlchars_ex(ret->scheme, (e - s));
+ goto end;
+ }
+
/*
* certain schemas like mailto: and zlib: may not have any / after them
* this check ensures we support those.
@@ -303,7 +309,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
ret->path = estrndup(s, (ue-s));
php_replace_controlchars_ex(ret->path, (ue - s));
}
-
+end:
return ret;
}
/* }}} */