-
-
Notifications
You must be signed in to change notification settings - Fork 149
Suggestion: when detecting promisable by method presense check its an object #161
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
Suggestion: when detecting promisable by method presense check its an object #161
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, thanks for looking into this @smscr 👍
[…] If it is a string, and the contents of the string can be resolved to a class in the global namespace, and the class has these methods it can lead to unwanted behavior.
Can you be more specific what kind of "unwanted behavior" you're referring to? Perhaps we can (should?) add a test case for this?
It looks like this applies the same fix like in #130, are there any other places that are affected by this?
@clue In my, case, a project has a class in global namespace which name was It was a bit of too much coincidence, but two people spend a decent amout of hours with coffee trying to figure out what the hell happens there |
@smscr Now that's a nasty one, thanks for digging into this! 😄 |
@WyriHaximus any chance of getting this fix backported on 1.x? It's breaking the Composer PHP 8 builds:
|
@Seldaek sure will port it back into |
Thanks! I'm sure other stuff will break once that one is fixed but it's preventing us from running any tests at all :) |
@WyriHaximus also if it can be backported to 2.x would probably make sense too. |
So @Seldaek this is actually v2 erroring. Also are you passing |
@WyriHaximus This PR addresses the v3.x release branch, we've applied the same fix with #130 in v2.7.1 and have yet to backport this to the v1.x release branch. |
@WyriHaximus you can see the details at https://github.com/composer/composer/runs/649345705?check_suite_focus=true incl stack trace. This is indeed running v2.7.1 but I'd like to make sure it works with 1.x on php 8 if possible. I think most of our usage is via anonymous functions rather than array callbacks, but I might well be forgetting some. |
@Seldaek are you also testing locally and if so how? Attempting to get a PHP 8 docker image running locally but running into some issues, also filed composer/composer#8878 but that's running into other issues |
The second commit (which affects the |
I did not test locally, just saw the failure on GH Actions sorry. |
The failure happens here: https://github.com/reactphp/promise/blob/v2.7.1/src/functions.php#L146 In 2.x, we allow the In 2.x we rely on 1.x doesn't need any backport as it neither supports foreign promises in So, we only need to backport what @CharlotteDunois suggests (#161 (comment)). I've filed a PR for this: #168 |
Thanks @jsor |
@Seldaek Fix released in v2.8.0 |
Thanks, seems to let it go through. |
Currently, detecting thenable causes unwanted side effects #160