mirror of
https://github.com/php/php-src.git
synced 2026-04-27 18:23:26 +02:00
075b6b85f6
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)
|