-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Allow casting CurlHandle to int #5743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Since we are changing from resources to objects, making |
@KalleZ The other resource conversions indeed don't do this, but I would expect us to do this for other cases where it's common, e.g. if we switch streams to use objects.
instead. Which is not particularly bad of course, but also not ideal. |
Closes GH-5402 Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
I went ahead and landed this to avoid unnecessary disruption. Happy to revert if we don't have a consensus (though per chat, it seems we do). |
Nice. 🎉 |
This mechanism currently seems to work for |
@derrabus It's written in the description:
|
It seems the answer is, yes. ;) |
Can you point me to some piece of code that does this for a curl multi handle? |
@nikic Wow, thanks a lot for the quick patch. ❤️ |
[PHP8 Testing] curl objects are no longer resources in PHP8, rather CurlHandle object type. Casting CurlHandle as (int) returns handle id. php/php-src#5743
It's common to cast curl resources to integer to get the resource ID. This allows casting the new CurlHandle object to int as well, returning the object ID. This seems like a simple way to improve compatibility with PHP 7.
Something to keep in mind is that unlike resource IDs, object IDs are reused.
I'm only doing this for CurlHandle, not CurlMultiHandle or CurlShareHandle. Do those need this as well?
cc @kocsismate @nicolas-grekas