]> granicus.if.org Git - php/commitdiff
Fixed bug #48733 (CURLOPT_WRITEHEADER|CURLOPT_FILE|CURLOPT_STDERR warns on
authorIlia Alshanetsky <iliaa@php.net>
Thu, 2 Jul 2009 13:41:29 +0000 (13:41 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 2 Jul 2009 13:41:29 +0000 (13:41 +0000)
  files that have been opened with r+).

NEWS
ext/curl/interface.c

diff --git a/NEWS b/NEWS
index 5403dc8861d0191fafd4e6884cd39bae35c9a214..ea330e16e478d45c660acc49448e8f1ff76205e4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@
 - Fixed regression in cURL extension that prevented flush of data to output
   defined as a file handle. (Ilia)
 
+- Fixed bug #48733 (CURLOPT_WRITEHEADER|CURLOPT_FILE|CURLOPT_STDERR warns on
+  files that have been opened with r+). (Ilia)
 - Fixed bug #48709 (metaphone and 'wh'). (brettz9 at yahoo dot com, Felipe)
 - Fixed bug #48693 (Double declaration of __lambda_func when lambda wrongly
   formatted). (peter at lvp-media dot com, Felipe)
index 8efa994c4f97eb9b244d4f2614e367805c95b288..58edf229045c8f8ea05deaf8d460e0813520c882 100644 (file)
@@ -1436,7 +1436,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
                        error = CURLE_OK;
                        switch (option) {
                                case CURLOPT_FILE:
-                                       if (((php_stream *) what)->mode[0] != 'r') {
+                                       if (((php_stream *) what)->mode[0] != 'r' || ((php_stream *) what)->mode[1] == '+') {
                                                zend_list_addref(Z_LVAL_PP(zvalue));
                                                ch->handlers->write->fp = fp;
                                                ch->handlers->write->method = PHP_CURL_FILE;
@@ -1447,7 +1447,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
                                        }
                                        break;
                                case CURLOPT_WRITEHEADER:
-                                       if (((php_stream *) what)->mode[0] != 'r') {
+                                       if (((php_stream *) what)->mode[0] != 'r' || ((php_stream *) what)->mode[1] == '+') {
                                                zend_list_addref(Z_LVAL_PP(zvalue));
                                                ch->handlers->write_header->fp = fp;
                                                ch->handlers->write_header->method = PHP_CURL_FILE;
@@ -1463,7 +1463,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
                                        ch->handlers->read->fd = Z_LVAL_PP(zvalue);
                                        break;
                                case CURLOPT_STDERR:
-                                       if (((php_stream *) what)->mode[0] != 'r') {
+                                       if (((php_stream *) what)->mode[0] != 'r' || ((php_stream *) what)->mode[1] == '+') {
                                                if (ch->handlers->std_err) {
                                                        zval_ptr_dtor(&ch->handlers->std_err);
                                                }