[php-src] Issue #20914: Internal enums can be cloned
| From: | arnaud-lb | Date: | Mon, 12 Jan 2026 16:24:28 +0000 |
| Subject: | [php-src] Issue #20914: Internal enums can be cloned | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251534@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20914
Author: arnaud-lb
### Description
The following code:
```php
<?php
var_dump(clone(ZendTestIntEnum::Foo) === ZendTestIntEnum::Foo);
```
Resulted in this output:
```
bool(false)
```
But I expected this output instead:
```
Uncaught Error: Trying to clone an uncloneable object of class ZendTestIntEnum
```
This is because we don't override the default object handlers in
zend_register_internal_enum().
### PHP Version
```plain
PHP 8.3
```
### Operating System
_No response_