Bug #78565 [Opn->Fbk]: Shutdown functions are not called when exit is called from output handler
Edit report at https://bugs.php.net/bug.php?id=78565&edit=1
ID: 78565
Updated by: cmb@php.net
Reported by: video dot ice dot power at seznam dot cz
Summary: Shutdown functions are not called when exit is
called from output handler
-Status: Open
+Status: Feedback
Type: Bug
Package: *General Issues
Operating System: Debian 9
PHP Version: 7.3.9
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I cannot reproduce this; I get (PHP-7.3 and -7.4 on Windows, and
PHP-7.4 on Debian):
Fatal error: ob_flush(): Cannot use output buffering in output buffering display handlers
So, apparently, the shutdown handler is executed. What am I
missing?
Previous Comments:
------------------------------------------------------------------------
[2019-12-17 18:25:57] archon810 at gmail dot com
We've been trying to figure out why Sentry doesn't fire in AMP and arrived at the same
conclusion - lack of the register_shutdown_function call when in ob_, which is used by AMP.
Please see https://github.com/getsentry/sentry-php/issues/927
and https://github.com/ampproject/amp-wp/issues/3825.
If any PHP core devs would chime in, that'd be great.
Thank you.
------------------------------------------------------------------------
[2019-09-19 07:41:42] video dot ice dot power at seznam dot cz
Description:
------------
Shutdown functions are not called when exit is called from output handler
Test script:
---------------
<?php
// capture any unexpected output and exit execution
ob_start(function($buffer) {
echo 'unexpected output: ' . $buffer . "\n";
exit;
}, 1);
// do some work on shutdown
register_shutdown_function(function() {
ob_flush();
ob_end_clean();
echo 'shutting down';
});
echo 'x';
Expected result:
----------------
unexpected output: x
shutting down
Actual result:
--------------
(empty result)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78565&edit=1
Thread (7 messages)