Skip to content

Commit bda5028

Browse files
committed
Fix enum reflection
1 parent d186354 commit bda5028

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

ext/reflection/php_reflection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ static void reflection_enum_case_factory(zend_class_entry *ce, zend_string *name
14851485
{
14861486
reflection_object *intern;
14871487

1488-
zend_class_entry *case_reflection_class = ce->backed_enum_table == IS_UNDEF
1488+
zend_class_entry *case_reflection_class = ce->enum_backing_type == IS_UNDEF
14891489
? reflection_enum_unit_case_ptr
14901490
: reflection_enum_backed_case_ptr;
14911491
reflection_instantiate(case_reflection_class, object);

ext/reflection/tests/ReflectionEnum_getCase.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ test(IntEnum::class, 'Baz');
3232

3333
?>
3434
--EXPECT--
35-
object(ReflectionEnumUnitCase)#3 (2) {
35+
object(ReflectionEnumUnitCase)#2 (2) {
3636
["name"]=>
3737
string(3) "Foo"
3838
["class"]=>
3939
string(5) "Enum_"
4040
}
4141
ReflectionException: Enum_::Bar is not a case
4242
ReflectionException: Case Enum_::Baz does not exist
43-
object(ReflectionEnumBackedCase)#3 (2) {
43+
object(ReflectionEnumBackedCase)#2 (2) {
4444
["name"]=>
4545
string(3) "Foo"
4646
["class"]=>

ext/reflection/tests/ReflectionEnum_getCases.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ var_dump((new ReflectionEnum(IntEnum::class))->getCases());
2222
--EXPECT--
2323
array(2) {
2424
[0]=>
25-
object(ReflectionEnumUnitCase)#4 (2) {
25+
object(ReflectionEnumUnitCase)#2 (2) {
2626
["name"]=>
2727
string(3) "Foo"
2828
["class"]=>
2929
string(5) "Enum_"
3030
}
3131
[1]=>
32-
object(ReflectionEnumUnitCase)#5 (2) {
32+
object(ReflectionEnumUnitCase)#3 (2) {
3333
["name"]=>
3434
string(3) "Bar"
3535
["class"]=>
@@ -38,14 +38,14 @@ array(2) {
3838
}
3939
array(2) {
4040
[0]=>
41-
object(ReflectionEnumBackedCase)#4 (2) {
41+
object(ReflectionEnumBackedCase)#2 (2) {
4242
["name"]=>
4343
string(3) "Foo"
4444
["class"]=>
4545
string(7) "IntEnum"
4646
}
4747
[1]=>
48-
object(ReflectionEnumBackedCase)#3 (2) {
48+
object(ReflectionEnumBackedCase)#1 (2) {
4949
["name"]=>
5050
string(3) "Bar"
5151
["class"]=>

0 commit comments

Comments
 (0)