[php-src] Issue #20714: Regression: Uncatchable exception
| From: | greg0ire | Date: | Mon, 15 Dec 2025 21:06:52 +0000 |
| Subject: | [php-src] Issue #20714: Regression: Uncatchable exception | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251394@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20714
Author: greg0ire
### Description
The following code:
```php
<?php
function gen(): Generator
{
try {
yield 1;
} finally {
}
}
function process(): void
{
$g = gen();
foreach ($g as $_) {
throw new Exception('ERROR');
}
}
try {
process();
} catch (Exception $e) {
echo "Caught\n";
}
```
Resulted in this output:
```
Fatal error: Uncaught Exception: ERROR in /in/a8M88:15
Stack trace:
#0 /in/a8M88(20): process()
#1 {main}
thrown in /in/a8M88 on line 15
Process exited with code 255.
```
But I expected this output instead:
```
Caught
```
This works with PHP 8.4.14, and it does not work with PHP 8.4.15
### PHP Version
```plain
PHP 8.4.15 (cli) (built: Nov 18 2025 17:26:05) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Fedora Project
Zend Engine v4.4.15, Copyright (c) Zend Technologies
```
### Operating System
_No response_