1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/enum/instanceof-unitenum.phpt
Arnaud Le Blanc 075b6b85f6 Set default_object_handlers when registering internal enums
Internal enums can be cloned and compared, unlike user enums, because we didn't set default_object_handlers when registering internal enums.

Fix by setting default_object_handlers when registering internal enums.

Fixes GH-20914
Closes GH-20915
2026-01-13 12:32:52 +01:00

23 lines
311 B
PHP

--TEST--
Auto implement UnitEnum interface
--EXTENSIONS--
zend_test
--FILE--
<?php
enum Foo {
case Bar;
}
class Baz {}
var_dump(Foo::Bar instanceof UnitEnum);
var_dump((new Baz()) instanceof UnitEnum);
var_dump(ZendTestUnitEnum::Foo instanceof UnitEnum);
?>
--EXPECT--
bool(true)
bool(false)
bool(true)