Edit report at https://bugs.php.net/bug.php?id=55428&edit=1
ID: 55428 Updated by: ka...@php.net Reported by: nicolas dot grekas+php at gmail dot com Summary: E_RECOVERABLE_ERROR when output buffering in output buffering handler Status: Open Type: Feature/Change Request Package: Output Control Operating System: any PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: 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(). Previous Comments: ------------------------------------------------------------------------ [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