mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
leave length as -1, no need to strdup()
This commit is contained in:
parent
1c7ea2045b
commit
ad84ce6233
1 changed files with 1 additions and 5 deletions
|
@ -467,7 +467,6 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
|
|||
zval *zfd = NULL;
|
||||
zval *zlength = NULL;
|
||||
zval *retval_ptr;
|
||||
int length;
|
||||
int error;
|
||||
zend_fcall_info fci;
|
||||
TSRMLS_FETCH_FROM_CTX(ch->thread_ctx);
|
||||
|
@ -499,13 +498,10 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
|
|||
error = zend_call_function(&fci, &t->fci_cache TSRMLS_CC);
|
||||
if (error == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_READFUNCTION");
|
||||
length = -1;
|
||||
} else {
|
||||
if(Z_TYPE_P(retval_ptr) == IS_STRING) {
|
||||
if (Z_TYPE_P(retval_ptr) == IS_STRING) {
|
||||
memcpy(data, Z_STRVAL_P(retval_ptr), size * nmemb);
|
||||
length = Z_STRLEN_P(retval_ptr);
|
||||
} else {
|
||||
data = strdup("");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue