Skip to content

Zend: compile time assert on Bucket size - #23079

Open
Sjord wants to merge 1 commit into
php:masterfrom
Sjord:assert-bucket-size
Open

Zend: compile time assert on Bucket size#23079
Sjord wants to merge 1 commit into
php:masterfrom
Sjord:assert-bucket-size

Conversation

@Sjord

@Sjord Sjord commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

In zend_compile.c, flags are stored in the lower bits of the Bucket address. If Bucket is aligned to 8 bytes, the lower three bits are always zero and this gives no problems. If the Bucket is not aligned, this results in non-obvious errors because the memory address and the flags overlap. This is difficult to debug when it happens, so add this assertion to make it more obvious what is wrong.

The flags are ZEND_BIND_REF, ZEND_BIND_IMPLICIT, ZEND_BIND_EXPLICIT.

Related to #19079

In zend_compile.c, flags are stored in the lower bits of the Bucket
address. If Bucket is aligned to 8 bytes, the lower three bits are
always zero and this gives no problems. If the Bucket is not aligned,
this results in non-obvious errors because the memory address and the
flags overlap. This is difficult to debug when it happens, so add this
assertion to make it more obvious what is wrong.

The flags are ZEND_BIND_REF, ZEND_BIND_IMPLICIT, ZEND_BIND_EXPLICIT.

Related to php#19079
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