mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +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
27 lines
405 B
PHP
27 lines
405 B
PHP
--TEST--
|
|
Auto implement BackedEnum interface
|
|
--EXTENSIONS--
|
|
zend_test
|
|
--FILE--
|
|
<?php
|
|
|
|
enum Foo {
|
|
case Bar;
|
|
}
|
|
|
|
enum Baz: int {
|
|
case Qux = 0;
|
|
}
|
|
|
|
var_dump(Foo::Bar instanceof BackedEnum);
|
|
var_dump(Baz::Qux instanceof BackedEnum);
|
|
var_dump(ZendTestUnitEnum::Foo instanceof BackedEnum);
|
|
var_dump(ZendTestIntEnum::Foo instanceof BackedEnum);
|
|
|
|
?>
|
|
--EXPECT--
|
|
bool(false)
|
|
bool(true)
|
|
bool(false)
|
|
bool(true)
|