jani                                     Sat, 25 Jul 2009 20:44:19 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=286323

Log:
- Fixed bug #48637 ("file" wrapper is overwritten when using 
--with-curlwrappers)
# Also fixes bug #48603, basically same issue.

Bugs: http://bugs.php.net/48637 (Assigned) "file" wrapper is overwritten when 
using --with-curlwrappers
      http://bugs.php.net/48603 (Open) Using --with-curlwrappers and 
open_basedir causes problems
      
Changed paths:
    U   php/php-src/branches/PHP_5_2/NEWS
    U   php/php-src/branches/PHP_5_2/ext/curl/interface.c
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/curl/interface.c
    U   php/php-src/trunk/ext/curl/interface.c

Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS   2009-07-25 20:39:01 UTC (rev 286322)
+++ php/php-src/branches/PHP_5_2/NEWS   2009-07-25 20:44:19 UTC (rev 286323)
@@ -29,6 +29,8 @@
 - 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).

Modified: php/php-src/branches/PHP_5_2/ext/curl/interface.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/curl/interface.c   2009-07-25 20:39:01 UTC 
(rev 286322)
+++ php/php-src/branches/PHP_5_2/ext/curl/interface.c   2009-07-25 20:44:19 UTC 
(rev 286323)
@@ -696,13 +696,24 @@
                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

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2009-07-25 20:39:01 UTC (rev 286322)
+++ php/php-src/branches/PHP_5_3/NEWS   2009-07-25 20:44:19 UTC (rev 286323)
@@ -46,6 +46,8 @@
   components). (Ilia)
 - Fixed bug #48681 (openssl signature verification for tar archives broken).
   (Greg)
+- Fixed bug #48637 ("file" fopen wrapper is overwritten when using
+  --with-curlwrappers). (Jani)
 - Fixed bug #48377 (error message unclear on converting phar with existing 
file).
   (Greg)
 - Fixed bug #48247 (Infinite loop and possible crash during startup with

Modified: php/php-src/branches/PHP_5_3/ext/curl/interface.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/curl/interface.c   2009-07-25 20:39:01 UTC 
(rev 286322)
+++ php/php-src/branches/PHP_5_3/ext/curl/interface.c   2009-07-25 20:44:19 UTC 
(rev 286323)
@@ -818,13 +818,24 @@
                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

Modified: php/php-src/trunk/ext/curl/interface.c
===================================================================
--- php/php-src/trunk/ext/curl/interface.c      2009-07-25 20:39:01 UTC (rev 
286322)
+++ php/php-src/trunk/ext/curl/interface.c      2009-07-25 20:44:19 UTC (rev 
286323)
@@ -818,13 +818,24 @@
                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

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

Reply via email to