From: Ilia Alshanetsky Date: Thu, 2 Jul 2009 13:41:29 +0000 (+0000) Subject: Fixed bug #48733 (CURLOPT_WRITEHEADER|CURLOPT_FILE|CURLOPT_STDERR warns on X-Git-Tag: php-5.2.11RC1~213 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8062b50a07beecce67998622649eb812772d2bd1;p=php Fixed bug #48733 (CURLOPT_WRITEHEADER|CURLOPT_FILE|CURLOPT_STDERR warns on files that have been opened with r+). --- diff --git a/NEWS b/NEWS index 5403dc8861..ea330e16e4 100644 --- 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) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 8efa994c4f..58edf22904 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -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); }