fix bug #48518 (curl crashes when writing into invalid file handle)

This commit is contained in:
Antony Dovgal 2009-06-11 09:46:27 +00:00
parent 433286f150
commit c6cd73e7d1

View file

@ -1666,6 +1666,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
switch (option) {
case CURLOPT_FILE:
if (((php_stream *) what)->mode[0] != 'r') {
zend_list_addref(Z_LVAL_PP(zvalue));
ch->handlers->write->fp = fp;
ch->handlers->write->method = PHP_CURL_FILE;
} else {
@ -1676,6 +1677,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') {
zend_list_addref(Z_LVAL_PP(zvalue));
ch->handlers->write_header->fp = fp;
ch->handlers->write_header->method = PHP_CURL_FILE;
} else {