From: Ilia Alshanetsky Date: Sun, 3 Sep 2006 16:32:27 +0000 (+0000) Subject: Fixed bug #38661 (mixed-case URL breaks url-wrappers). X-Git-Tag: php-5.2.0RC4~113 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4427552b604e6ae3ccf781f72450e0bfcbb9fd8e;p=php Fixed bug #38661 (mixed-case URL breaks url-wrappers). --- diff --git a/NEWS b/NEWS index 1474a6748c..aacd6cb228 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Sep 2006, PHP 5.2.0RC4 +- Fixed bug #38661 (mixed-case URL breaks url-wrappers). (Ilia) + 31 Aug 2006, PHP 5.2.0RC3 - Updated PCRE to version 6.7. (Ilia) diff --git a/main/streams/streams.c b/main/streams/streams.c index 12a6fa4d29..984eac9f0a 100755 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1526,18 +1526,24 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char } if (protocol) { - if (FAILURE == zend_hash_find(wrapper_hash, (char*)protocol, n, (void**)&wrapperpp)) { - char wrapper_name[32]; - - if (n >= sizeof(wrapper_name)) - n = sizeof(wrapper_name) - 1; - PHP_STRLCPY(wrapper_name, protocol, sizeof(wrapper_name), n); + if (FAILURE == zend_hash_find(wrapper_hash, (char*)protocol, n, (void**)&wrapperpp)) { + char *tmp = estrndup(protocol, n); + php_strtolower(tmp, n); + if (FAILURE == zend_hash_find(wrapper_hash, (char*)tmp, n, (void**)&wrapperpp)) { + char wrapper_name[32]; + + efree(tmp); + if (n >= sizeof(wrapper_name)) { + n = sizeof(wrapper_name) - 1; + } + PHP_STRLCPY(wrapper_name, protocol, sizeof(wrapper_name), n); - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to find the wrapper \"%s\" - did you forget to enable it when you configured PHP?", - wrapper_name); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to find the wrapper \"%s\" - did you forget to enable it when you configured PHP?", wrapper_name); - wrapperpp = NULL; - protocol = NULL; + wrapperpp = NULL; + protocol = NULL; + } + efree(tmp); } } /* TODO: curl based streams probably support file:// properly */