Issue: https://github.com/php/php-src/issues/7957
Author: mvorisek
### Description
Original report https://bugs.php.net/bug.php?id=78565
The following code:
```php
<?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';
```
Resulted in this output:
```
xunexpected output: x
unexpected output:
```
But I expected this output instead:
```
unexpected output: x
shutting down
```
### PHP Version
8.0+
### Operating System
any