diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-10-01 17:05:23 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-10-01 17:05:23 +0200 |
commit | d96219c185e68c82beb994db2c93bd26f47ce16a (patch) | |
tree | a8576ab9c9bf68c94536008df3b0256e56c0467e /ext/curl/interface.c | |
parent | f82414e935c18c1ff45ef1f006e24220631f5717 (diff) | |
download | php-git-d96219c185e68c82beb994db2c93bd26f47ce16a.tar.gz |
Fixed bug #80121
The issue affected both CurlHandle and CurlMultiHandle. I'll have
to double check this for other resource->object conversions as well.
Diffstat (limited to 'ext/curl/interface.c')
-rw-r--r-- | ext/curl/interface.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 150f98d46f..8ff3e0f374 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -3308,6 +3308,12 @@ static void curl_free_obj(zend_object *object) fprintf(stderr, "DTOR CALLED, ch = %x\n", ch); #endif + if (!ch->cp) { + /* Can happen if constructor throws. */ + zend_object_std_dtor(&ch->std); + return; + } + _php_curl_verify_handlers(ch, 0); /* @@ -3321,12 +3327,10 @@ static void curl_free_obj(zend_object *object) * * Libcurl commit d021f2e8a00 fix this issue and should be part of 7.28.2 */ - if (ch->cp != NULL) { - curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION, curl_write_nothing); - curl_easy_setopt(ch->cp, CURLOPT_WRITEFUNCTION, curl_write_nothing); + curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION, curl_write_nothing); + curl_easy_setopt(ch->cp, CURLOPT_WRITEFUNCTION, curl_write_nothing); - curl_easy_cleanup(ch->cp); - } + curl_easy_cleanup(ch->cp); /* cURL destructors should be invoked only by last curl handle */ if (--(*ch->clone) == 0) { |