Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[VarDumper] Fixed dumping of terminated generator#21542
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
lyrixx commentedFeb 6, 2017
| Q | A |
|---|---|
| Branch? | 2.8 |
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | - |
| License | MIT |
| Doc PR | - |
| try { | ||
| $reflectionGenerator =new \ReflectionGenerator($c); | ||
| }catch (\Exception$e) { | ||
| return$a; |
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.
let's add a virtual prop that says closed: true?
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.
Good idea. Added.
| $a[$prefix.'this'] =newCutStub($c->getThis()); | ||
| } | ||
| $x =$c->getFunction(); | ||
| $function =$c->getFunction(); |
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.
diff irrelevant for review
| { | ||
| returnclass_exists('ReflectionGenerator',false) ?self::castReflectionGenerator(new \ReflectionGenerator($c),$a,$stub,$isNested) :$a; | ||
| if (!class_exists('ReflectionGenerator',false)) { | ||
| return$a; |
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.
closed: true/false virtual prop?
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.
How can I know?
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.
call->valid()?
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 can not because it alters the generator. That's why I used the try catch method and not->valid().
nicolas-grekas left a comment
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.
👍
| // Cannot create ReflectionGenerator based on a terminated Generator | ||
| try { | ||
| $reflectionGenerator =new \ReflectionGenerator($c); | ||
| }catch (\Exception$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.
I confirm that anException is thrown here, even-though I'd personally have expected aReflectionException
ping@jpauli.
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 has been fixed as part of PHP 7.2 inphp/php-src@ed4216c
nicolas-grekas commentedFeb 6, 2017
Thank you@lyrixx. |
This PR was merged into the 2.8 branch.Discussion----------[VarDumper] Fixed dumping of terminated generator| Q | A| ------------- | ---| Branch? | 2.8| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -Commits-------c5094a0 [VarDumper] Fixed dumping of terminated generator