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

NEWS
ext/curl/interface.c

diff --git a/NEWS b/NEWS
index be6cf6c74153f880588a9855ce5e2087c18aea02..5f6a8d4cd9f7b19f0fc999132306a37677b417dd 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@
   Functors. (Christian Seiler)
 
 - Fixed bug #48757 (ReflectionFunction::invoke() parameter issues). (Kalle)
+- Fixed bug #48733 (CURLOPT_WRITEHEADER|CURLOPT_FILE|CURLOPT_STDERR warns on
+  files that have been opened with r+). (Ilia)
 - Fixed bug #48681 (openssl signature verification for tar archives broken).
   (Greg)
 - Fixed bug #47351 (Memory leak in DateTime). (Derick, Tobias John)
index 04deb1fb243ed035492a7cdee8610e769924e641..3a472374afcceaa5f23fe6aa51eb741a3cac51d9 100644 (file)
@@ -1649,7 +1649,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;
@@ -1660,7 +1660,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;
@@ -1676,7 +1676,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);
                                                }