Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -2371,6 +2371,19 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
int type;
void * what;

/* If a NULL was supplied together with INFILE, reset the default if we're still at direct i/o and don't have a user-function for read */
/* TODO: Allow setting to NULL for other combinations */
if(Z_TYPE_PP(zvalue) == IS_NULL && option == CURLOPT_INFILE && ch->handlers->read->method == PHP_CURL_DIRECT) {
if(ch->handlers->read->stream != NULL) {
zval_ptr_dtor(&ch->handlers->read->stream);
}
ch->handlers->read->fd = 0;
ch->handlers->read->fp = 0;
ch->handlers->read->stream = NULL;
error = curl_easy_setopt(ch->cp, CURLOPT_INFILE, (void *) ch);
break;
}

what = zend_fetch_resource(zvalue TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream(), php_file_le_pstream());
if (!what) {
RETVAL_FALSE;
Expand Down