From 425c71443565f2ec62808715e0a5baf561725ab9 Mon Sep 17 00:00:00 2001 From: Sterling Hughes Date: Sat, 28 Apr 2001 21:44:44 +0000 Subject: [PATCH] # Actually fix the bug this time (I fixed another bug last time :) --- ext/curl/curl.c | 8 +++++--- ext/curl/php_curl.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ext/curl/curl.c b/ext/curl/curl.c index 6fac748527..ad54b899c1 100644 --- a/ext/curl/curl.c +++ b/ext/curl/curl.c @@ -580,9 +580,10 @@ PHP_FUNCTION(curl_exec) php_error(E_WARNING, "Cannot initialize temporary file to save output from %s()", get_active_function_name()); RETURN_FALSE; } - - curl_easy_setopt(curl_handle->cp, CURLOPT_FILE, fp); - + curl_handle->tmp_fp = fp; + + curl_easy_setopt(curl_handle->cp, CURLOPT_FILE, fp); + is_temp_file = 1; } else if (curl_handle->return_transfer && @@ -803,6 +804,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc) { php_curl *curl_handle = (php_curl *)rsrc->ptr; curl_easy_cleanup(curl_handle->cp); + if (curl_handle->tmp_fp) fclose(curl_handle->tmp_fp); zend_llist_clean(&curl_handle->to_free); efree(curl_handle); } diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h index 838cb1d382..58ee10aa2b 100644 --- a/ext/curl/php_curl.h +++ b/ext/curl/php_curl.h @@ -55,6 +55,7 @@ typedef struct { int php_stdout; int cerrno; char error[CURL_ERROR_SIZE+1]; + FILE *tmp_fp; CURL *cp; zend_llist to_free; } php_curl; -- 2.40.0