]> granicus.if.org Git - php/commitdiff
- Fixed bug #48637 ("file" wrapper is overwritten when using --with-curlwrappers)
authorJani Taskinen <jani@php.net>
Sat, 25 Jul 2009 20:44:19 +0000 (20:44 +0000)
committerJani Taskinen <jani@php.net>
Sat, 25 Jul 2009 20:44:19 +0000 (20:44 +0000)
# Also fixes bug #48603, basically same issue.

NEWS
ext/curl/interface.c

diff --git a/NEWS b/NEWS
index 64a2f34f4fc7c458a18c32a6f846163f6de2542c..4b52774f13967d3dbf25cedeaca08445a6706602 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,8 @@ PHP                                                                        NEWS
 - Fixed bug #48693 (Double declaration of __lambda_func when lambda wrongly
   formatted). (peter at lvp-media dot com, Felipe)
 - Fixed bug #48661 (phpize is broken with non-bash shells). (Jani)
+- Fixed bug #48637 ("file" fopen wrapper is overwritten when using
+  --with-curlwrappers). (Jani)
 - Fixed bug #48636 (Error compiling of ext/date on netware). (guenter at
   php.net, Ilia)
 - Fixed bug #48629 (get_defined_constants() ignores categorize parameter).
index a431522d442d2861cc9f4493973a597127fb46c2..fccf72daa0eb4898d296c7c871a7047a46e6bb6b 100644 (file)
@@ -696,13 +696,24 @@ PHP_MINIT_FUNCTION(curl)
                char **p = (char **)info->protocols;
 
                while (*p != NULL) {
-                       php_register_url_stream_wrapper(*p++, &php_curl_wrapper TSRMLS_CC);
+                       /* Do not enable cURL "file" protocol and make sure cURL is always used when --with-curlwrappers is enabled */
+                       if (strncasecmp(*p, "file", sizeof("file")-1) != 0) {
+                               php_unregister_url_stream_wrapper(*p);
+                               php_register_url_stream_wrapper(*p, &php_curl_wrapper TSRMLS_CC);
+                       }
+                       (void) *p++;
                }
        }
 # else
+       php_unregister_url_stream_wrapper("http");
        php_register_url_stream_wrapper("http", &php_curl_wrapper TSRMLS_CC);
+       php_unregister_url_stream_wrapper("https");
        php_register_url_stream_wrapper("https", &php_curl_wrapper TSRMLS_CC);
+       php_unregister_url_stream_wrapper("ftp");
        php_register_url_stream_wrapper("ftp", &php_curl_wrapper TSRMLS_CC);
+       php_unregister_url_stream_wrapper("ftps");
+       php_register_url_stream_wrapper("ftps", &php_curl_wrapper TSRMLS_CC);
+       php_unregister_url_stream_wrapper("ldap");
        php_register_url_stream_wrapper("ldap", &php_curl_wrapper TSRMLS_CC);
 # endif
 #endif