From e9304d08b8c9047f3b55b44c8f603c16ffc5553d Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Thu, 2 Jul 2009 13:42:24 +0000 Subject: [PATCH] MFB: Fixed bug #48733 (CURLOPT_WRITEHEADER|CURLOPT_FILE|CURLOPT_STDERR warns on files that have been opened with r+). --- ext/curl/interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 6d40d6dd3c..ef4c314332 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1665,7 +1665,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; @@ -1676,7 +1676,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; @@ -1692,7 +1692,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); } -- 2.50.1