iliaa           Sun Sep  3 16:33:03 2006 UTC

  Modified files:              
    /php-src/main/streams       streams.c 
  Log:
  MFB: Fixed bug #38661 (mixed-case URL breaks url-wrappers).
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.130&r2=1.131&diff_format=u
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.130 
php-src/main/streams/streams.c:1.131
--- php-src/main/streams/streams.c:1.130        Tue Aug  8 16:59:11 2006
+++ php-src/main/streams/streams.c      Sun Sep  3 16:33:02 2006
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.130 2006/08/08 16:59:11 tony2001 Exp $ */
+/* $Id: streams.c,v 1.131 2006/09/03 16:33:02 iliaa Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -1988,18 +1988,24 @@
        }
 
        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 */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to