]> 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.

ext/curl/interface.c

index a3e06c9c820e8a8fdeddf469a606b93bbba39437..bfb73c73eab2719f5a2db2653485cd3212bc461f 100644 (file)
@@ -818,13 +818,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