[php-src] Issue #8866: ob handler should not print the output in case of callback exception
| From: | mvorisek | Date: | Sat, 25 Jun 2022 09:44:05 +0000 |
| Subject: | [php-src] Issue #8866: ob handler should not print the output in case of callback exception | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241805@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8866
Author: mvorisek
### Description
The following code:
```php
<?php
ob_start(function ($buffer) {
// return '';
throw new \Exception('x');
});
echo 5;
try {
ob_flush();
} catch (\Exception $e) {
echo $e;
}
```
Resulted in this output:
```diff
-5Exception: x in /in/kQMfY:5
+5Exception: x in /in/kQMfY:5
Stack trace:
#0 [internal function]: {closure}('5', 5)
#1 /in/kQMfY(11): ob_flush()
#2 {main}
```
https://3v4l.org/kQMfY
### PHP Version
any
### Operating System
any