]> granicus.if.org Git - php/commitdiff
Fixed bug #38661 (mixed-case URL breaks url-wrappers).
authorIlia Alshanetsky <iliaa@php.net>
Sun, 3 Sep 2006 16:32:27 +0000 (16:32 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 3 Sep 2006 16:32:27 +0000 (16:32 +0000)
NEWS
main/streams/streams.c

diff --git a/NEWS b/NEWS
index 1474a6748c553a355cf0cd89bc0ff6c10ef92e70..aacd6cb228742ed56a00a84aee979fdabe8285b8 100644 (file)
--- 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)
index 12a6fa4d295421db3e0045247356cba0f24c51ad..984eac9f0af9ff0e663b5255f1999501453c1a95 100755 (executable)
@@ -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 */