Skip to content

Fix GH-22782: preloading FCC const exprs#22783

Open
arnaud-lb wants to merge 1 commit into
php:PHP-8.5from
arnaud-lb:gh22782
Open

Fix GH-22782: preloading FCC const exprs#22783
arnaud-lb wants to merge 1 commit into
php:PHP-8.5from
arnaud-lb:gh22782

Conversation

@arnaud-lb

Copy link
Copy Markdown
Member

Fixes GH-22782.

Preloading will try to evaluate class constants during compilation, but evaluated FCCs are objects, which can not be persisted. Apply the same fix as for enums: Fail evaluation when compiling.

Preloading will also reset CG(map_ptr_last) after compilation, which results in collisions if map ptrs were allocated during compilation. Move the ZEND_MAP_PTR_NEW() to the persist phase, as a shared map ptr is not necessary before that.

Preloading will try to evaluate class constants during compilation, but
evaluated FCCs are objects, which can not be persisted. Apply the same fix as
for enums: Fail evaluation when compiling.

Preloading will also reset CG(map_ptr_last) after compilation, which results in
collisions if map ptrs were allocated during compilation. Move the
ZEND_MAP_PTR_NEW() to the persist phase, as a shared map ptr is not necessary
before that.

@TimWolla TimWolla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests LGTM, can't meaningfully comment on the C code.

@arnaud-lb
arnaud-lb marked this pull request as ready for review July 17, 2026 17:47
@arnaud-lb
arnaud-lb requested a review from dstogov as a code owner July 17, 2026 17:47
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.

Const expr FCC crashes under preloading

2 participants