Skip to content

Conversation

@cmb69
Copy link
Member

@cmb69 cmb69 commented Mar 11, 2020

We must not increase the refcount of the resource; we only have to make
sure that the actual CURL handle is not freed prematurely, but this is
already catered to in _php_setup_easy_copy_handlers().

We must not increase the refcount of the resource; we only have to make
sure that the actual CURL handle is not freed prematurely, but this is
already catered to in `_php_setup_easy_copy_handlers()`.
@nikic
Copy link
Member

nikic commented Mar 12, 2020

To clarify, you're saying that this is handled by the clone mechanism, right?

@cmb69
Copy link
Member Author

cmb69 commented Mar 12, 2020

To clarify, you're saying that this is handled by the clone mechanism, right?

To be precise, it's handled by

PHP_FUNCTION(curl_copy_handle)

@nikic
Copy link
Member

nikic commented Mar 12, 2020

@cmb69 Are you sure you linked to the right line there?

@cmb69
Copy link
Member Author

cmb69 commented Mar 12, 2020

Indeed, badly explained (in the commit message as well) – sorry! The point is that that curl_copy_handle() registers a new resource, so increasing the refcount of the original resource prevents it from ever get freed (before the end of the request). Currently, the only way to destroy the underlying php_curl struct is to call curl_close(), because that calls zend_list_close() – but that doesn't free the actual zend_resource.

@cmb69
Copy link
Member Author

cmb69 commented Mar 12, 2020

Thanks! Applied as 2b5fc8e.

@cmb69 cmb69 closed this Mar 12, 2020
@cmb69 cmb69 deleted the cmb/79199 branch March 12, 2020 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants