Bug #78565 [Com]: 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
Comment by: archon810 at gmail dot com
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
Type: Bug
Package: *General Issues
Operating System: Debian 9
PHP Version: 7.3.9
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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)