From: Operating system: any PHP version: 5.3.6 Package: Output Control Bug Type: Feature/Change Request Bug description:E_RECOVERABLE_ERROR when output buffering in output buffering handler
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 bug report at https://bugs.php.net/bug.php?id=55428&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55428&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55428&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55428&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55428&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55428&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55428&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55428&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55428&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55428&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55428&r=support Expected behavior: https://bugs.php.net/fix.php?id=55428&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55428&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55428&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55428&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55428&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=55428&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55428&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55428&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55428&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55428&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55428&r=mysqlcfg