Skip to content

Fix GH-21687: assertion failure in zend_enum_fetch_case_name after array_walk#25

Closed
iliaal wants to merge 1 commit intomasterfrom
fix/gh-21687-enum-array-walk-assertion
Closed

Fix GH-21687: assertion failure in zend_enum_fetch_case_name after array_walk#25
iliaal wants to merge 1 commit intomasterfrom
fix/gh-21687-enum-array-walk-assertion

Conversation

@iliaal
Copy link
Copy Markdown
Owner

@iliaal iliaal commented Apr 9, 2026

Fixes php#21687

array_walk() wraps object properties in IS_REFERENCE when passing them to the callback. For enum objects, this converts the name property from IS_STRING to IS_REFERENCE in-place. A subsequent var_dump() calls zend_enum_fetch_case_name() which asserts IS_STRING on the property, triggering an assertion failure.

Derefs through IS_REFERENCE in both zend_enum_fetch_case_name() and zend_enum_fetch_case_value() before accessing the value.

… array_walk

array_walk() wraps object properties in IS_REFERENCE when passing
them to the callback. For enum objects, this converts the name
property from IS_STRING to IS_REFERENCE in-place. A subsequent
var_dump() calls zend_enum_fetch_case_name() which asserts IS_STRING
on the property, triggering an assertion failure.

Dereference through IS_REFERENCE in both zend_enum_fetch_case_name()
and zend_enum_fetch_case_value() before accessing the value.

Closes phpGH-21687
@iliaal
Copy link
Copy Markdown
Owner Author

iliaal commented Apr 9, 2026

Submitted upstream as php#21690

@iliaal iliaal closed this Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assertion failure in zend_enum_fetch_case_name() when calling array_walk() on an enum case value after try/catch block

1 participant