Skip to content

Fix GH-25645: Segfault comparing trait values that use parent - #25646

Open
lazerg wants to merge 1 commit into
php:PHP-8.5from
lazerg:fix/gh-25645
Open

lazerg wants to merge 1 commit into
php:PHP-8.5from
lazerg:fix/gh-25645

Conversation

@lazerg

@lazerg lazerg commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes GH-25645

Since traits are bound before the parent class, ce->parent still holds the parent name while trait constants and properties are bound. When a value has to be evaluated to check it against a second definition, parent reads that string as a class entry and crashes.

zend_do_link_class() already has the parent class entry at that point, so I resolve ce->parent before binding the traits. zend_do_inheritance_ex() then skips releasing parent_name when the parent is already resolved.

The self::A case from the issue does not crash and still fails the same way, since the parent constants are not inherited yet at that point. I left it out of this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant