]> 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:24 +0000 (13:42 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 2 Jul 2009 13:42:24 +0000 (13:42 +0000)
on files that have been opened with r+).

ext/curl/interface.c

index 6d40d6dd3c167753fc720783c8c37e5e2ea5d1cd..ef4c31433222e7a432ca39323708c08224b90342 100644 (file)
@@ -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);
                                                }