[php-src] Issue #25340: ReflectionEnumBackedCase can be used on a non-backed enum via a constructor trick
| From: | ndossche | Date: | Mon, 09 Nov 2026 14:52:33 +0000 |
| Subject: | [php-src] Issue #25340: ReflectionEnumBackedCase can be used on a non-backed enum via a constructor trick | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-254101@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/25340
Author: ndossche
### Description
The following code:
```php
<?php
enum NotBacked { case A; };
class FU extends ReflectionEnumBackedCase {
public function __construct($class, $const) {
ReflectionClassConstant::__construct($class, $const);
}
}
$fu = new FU('NotBacked', 'A');
$fu->getBackingValue();
```
Resulted in this output:
```
*explosion*
```
But I expected this output instead:
```
exception
```
### PHP Version
```plain
8.4+
```
### Operating System
_No response_