-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Implement a Drupal8ForkingLoop to handle AssertionErrors that get thrown #2635
Implement a Drupal8ForkingLoop to handle AssertionErrors that get thrown #2635
Conversation
} catch (\Exception $e) { | ||
// we'll just ignore this one... | ||
} | ||
catch (\AssertionError $e) { |
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.
This is really the part we need, the rest is copied from the Psy\ElavuationLoop\ForkingLoop
class.
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.
I'm wondering whether it would be easier to fix that maybe upstream somehow?
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.
Yeah, I thought about that first, but Psysh supports PHP5.6 and above. So we would need to add some \AssertionError exception like Drupal does. Which I think might be a no go... at least until it was only support PHP7.
Are you sure this would actually break in 5.6? PHP is quite flexible in
those cases.
Damian Lee <notifications@github.com> schrieb am Mi., 22. Feb. 2017 um
10:54 Uhr:
… ***@***.**** commented on this pull request.
------------------------------
In src/Psysh/Drupal8ForkingLoop.php
<#2635 (comment)>:
> + if ($key === '_' || $key === '_e') {
+ continue;
+ }
+
+ // Resources don't error, but they don't serialize well either.
+ if (is_resource($value) || $value instanceof \Closure) {
+ continue;
+ }
+
+ try {
+ @serialize($value);
+ $serializable[$key] = $value;
+ } catch (\Exception $e) {
+ // we'll just ignore this one...
+ }
+ catch (\AssertionError $e) {
Yeah, I thought about that first, but Psysh supports PHP5.6 and above. So
we would need to add some \AssertionError exception like Drupal does. Which
I think might be a no go... at least until it was only support PHP7.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2635 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABz7k3n7pWrDW1o-HkRhV7LLgmR_v9Bks5rfBPmgaJpZM4MIcUv>
.
|
Yeah, seems it doesn't actually break PHP. It's still kind of dubious though IMO. I have made an upstream PR anyway bobthecow/psysh#358. Let's see. Otherwise, it's Drupal's fault for implementing this in the container really. |
Looks like upstream PR is fine! 🎉 Let's leave this one until that is merged. |
Note: maybe drush wants to ensure that the up to date version is actually
used by adapting its composer.json file?
Damian Lee <notifications@github.com> schrieb am Mi., 22. Feb. 2017 um
16:13 Uhr:
… Looks like upstream PR is fine! 🎉 Let's leave this one until that is
merged.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2635 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABz7nq8upR0gnC8vDJbvZnlafLy7gN6ks5rfF6cgaJpZM4MIcUv>
.
|
You'd think that, but composer will still get the latest version (currently 0.8.1) |
Oh nice
Damian Lee <notifications@github.com> schrieb am Mi., 22. Feb. 2017 um
18:40 Uhr:
… You'd think that, but composer will still get the latest version
(currently 0.8.1)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2635 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABz7i80UQILXrFgW7zbR9HcWfLiCea3ks5rfIEHgaJpZM4MIcUv>
.
|
Fixes #2635: Bump psy/psysh version to 0.8.2
When using Drupal 8 and assertions are enabled using PHP7 (PHP5 we support our own \AssertionError class which does extend Exception), which is very likely in development, our shell cannot handle
AssertionError
s. This is most evident when the FokingLoop tries to serialize the container to keep state in the REPL. This is not just the container directly, but E.g. The entity manager has a reference which tries to get serialized too.Alas, we need to override the whole
ForkingLoop
implementation that ships with Psysh to catch the exception in the correct place. We then avoid errors like this: