Skip to content
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

CurlHandle and CurlMultiHandle are castable to int in php8 #3939

Closed
xPaw opened this issue Oct 12, 2020 · 6 comments
Closed

CurlHandle and CurlMultiHandle are castable to int in php8 #3939

xPaw opened this issue Oct 12, 2020 · 6 comments

Comments

@xPaw
Copy link

xPaw commented Oct 12, 2020

php/php-src#5743

I'm not sure where I would apply this change in phpstan, so creating this issue instead. As I was testing the new phpstan release, spotted this.

PHP8 allows casting these to ints to preserve backwards compatibility.

https://phpstan.org/r/16e2b057-6de9-4d84-b321-59042800a3e6

@ondrejmirtes
Copy link
Member

Thank you for letting me know, but I think it's better to notify the user about this so that they're aware this is no longer a resource, rather than implementing this unique "object castable to integer" semantics...

@xPaw
Copy link
Author

xPaw commented Oct 12, 2020

Well, it is a useful mechanism, which is why php8 added this in the first place, as plenty of codebases use this. Namely composer and symphony.

It's especially useful when doing multi curl, to keep track of curl handles in an array.

@ondrejmirtes
Copy link
Member

What would be an object-first alternative? spl_object_hash?

@ondrejmirtes ondrejmirtes reopened this Oct 12, 2020
@xPaw
Copy link
Author

xPaw commented Oct 12, 2020

spl_object_id I guess.

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@842b468

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants