Req #55428 [Asn->Csd]: E_RECOVERABLE_ERROR when output buffering in output buffering handler
| From: | kalle@php.net | Date: | Sat, 27 Dec 2014 19:57:22 +0000 |
| Subject: | Req #55428 [Asn->Csd]: E_RECOVERABLE_ERROR when output buffering in output buffering handler | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-189231@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55428&edit=1
ID: 55428
Updated by: kalle@php.net
Reported by: nicolas dot grekas+php at gmail dot com
Summary: E_RECOVERABLE_ERROR when output buffering in output
buffering handler
-Status: Assigned
+Status: Closed
Type: Feature/Change Request
Package: Output Control
Operating System: any
PHP Version: 5.3.6
Assigned To: kalle
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
This change is now implemented in PHP7.
Previous Comments:
------------------------------------------------------------------------
[2011-08-22 14:22:18] kalle@php.net
I agree that we should change to use E_RECOVERABLE_ERROR here, as we don't leave the Engine in
an unresolverable state (as the output layer is in the PHP part of the package).
As for the function suggestion, it doesn't make much sense to add a function to check if you
are in a function for a function which purpose is to be used as a callback for ob_start().
------------------------------------------------------------------------
[2011-08-15 22:00:21] nicolas dot grekas+php at gmail dot com
Description:
------------
Output buffering inside output buffering handler is currently forbidden.
Ideally, this limitation could be removed, but as this may be too much work, I mostly really miss
some way to test whether my code is running inside an output buffering handler or not (for example
in a custom error handler).
PHP really miss a way to check for this situation.
Currently, when using output buffering in an output buffering handler context, an E_ERROR is thrown.
Could it be possible to trigger an E_RECOVERABLE_ERROR instead? This would allow me to catch the
situation and degrade gracefully.
Or maybe a new special function "ob_in_handler()", returning a boolean, is a better idea ?
Test script:
---------------
<?php
ob_start('abc');
function abc()
{
ob_start();
}
?>
Expected result:
----------------
PHP Catchable fatal error: ob_start(): Cannot use output buffering in output buffering display
handlers in [...] on line 5
Actual result:
--------------
PHP Fatal error: ob_start(): Cannot use output buffering in output buffering display handlers in
[...] on line 5
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55428&edit=1