-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Debug] work-around https://bugs.php.net/61272 #11099
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
@@ -99,8 +99,8 @@ public function handle(\Exception $exception) | |||
$this->caughtOutput = false; | |||
ob_start(array($this, 'catchOutput')); | |||
$this->failSafeHandle($exception); | |||
if (false === $this->caughtOutput) { | |||
ob_end_clean(); | |||
while (false === $this->caughtOutput && ob_end_flush()) { |
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.
ob_end_flush actually sends the buffer whereas ob_end_clean doesn't?! is this change intended?
Yes: the handler returns '' so both are equivalent in this case |
OK. The code is pretty hard to understand. |
Patch updated, should be easier to understand |
|
||
try { | ||
call_user_func($this->handler, $exception); | ||
|
||
if ($caughtOutput) { | ||
$this->caughtOutput = $caughtOutput; | ||
if ($caughtLength) { |
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.
is this if statement necessary? I don't see why
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.
So do I :)
👍 |
ob_start(array($this, 'catchOutput')); | ||
$this->failSafeHandle($exception); | ||
if (false === $this->caughtOutput) { | ||
ob_end_clean(); | ||
while (null === $this->caughtBuffer && ob_end_flush()) { |
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.
why is it a loop now ?
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.
As locally I don't want to know anything about failSafeHandle(), several ob_start() could have been started somewhere else. This loop just closes all these potentially opened buffers. Fail-safe and defensive coding practice.
👍 |
1 similar comment
👍 |
…ekas) This PR was merged into the 2.5 branch. Discussion ---------- [Debug] work-around https://bugs.php.net/61272 | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #8703 | License | MIT https://bugs.php.net/61272 is the real offender. Using ob_end_flush() instead of ob_end_clean() is the fix. Commits ------- cb8aff3 [Debug] work-around https://bugs.php.net/61272
https://bugs.php.net/61272 is the real offender.
Using ob_end_flush() instead of ob_end_clean() is the fix.