From 9817dbb9b07a6e9ce649d2eeaf36d63f24d74557 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Tue, 16 Aug 2005 14:12:13 +0000 Subject: [PATCH] MFH: Fixed bug #34148 (+,- and . not supported as parts of scheme). --- NEWS | 1 + ext/standard/tests/strings/url_t.phpt | 13 ++++++++++++- ext/standard/url.c | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 91662b4fa3..1d8ccda05c 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ PHP 4 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2005, Version 4.4.1 +- Fixed bug #34148 (+,- and . not supported as parts of scheme). (Ilia) - Fixed bug #34068 (Numeric string as array key not cast to integer in wddx_deserialize()). (Ilia) - Fixed bug #34064 (arr[] as param to function is allowed only if function diff --git a/ext/standard/tests/strings/url_t.phpt b/ext/standard/tests/strings/url_t.phpt index 6e65b1d1bb..86605ace27 100644 --- a/ext/standard/tests/strings/url_t.phpt +++ b/ext/standard/tests/strings/url_t.phpt @@ -70,7 +70,8 @@ $sample_urls = array ( 'file:/path/to/file', 'http://1.2.3.4:/abc.asp?a=1&b=2', 'http://foo.com#bar', -'scheme:' +'scheme:', +'foo+bar://baz@bang/bla', ); foreach ($sample_urls as $url) { @@ -664,3 +665,13 @@ array(1) { ["scheme"]=> string(6) "scheme" } +array(4) { + ["scheme"]=> + string(7) "foo+bar" + ["host"]=> + string(4) "bang" + ["user"]=> + string(3) "baz" + ["path"]=> + string(4) "/bla" +} diff --git a/ext/standard/url.c b/ext/standard/url.c index b6514850e6..3805f54adb 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -107,7 +107,8 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) /* validate scheme */ p = s; while (p < e) { - if (!isalnum(*p)) { + /* scheme = 1*[ lowalpha | digit | "+" | "-" | "." ] */ + if (!isalpha(*p) && !isdigit(*p) && *p != '+' && *p != '.' && *p != '-') { if (e + 1 < ue) { goto parse_port; } else { -- 2.40.0