mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
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
23 lines
311 B
PHP
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)
|