Commit 5206ff33ca2 for php.net

commit 5206ff33ca21be3bcbe5e402fcb856978ff457df
Author: Sjoerd Langkemper <sjoerd-github@linuxonly.nl>
Date:   Mon Aug 10 10:04:23 2026 +0200

    Zend: compile time assert on Bucket size (#23079)

    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 GH-19079

diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index a2f126fb101..882b1bf990b 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5916,6 +5916,8 @@ static void zend_compile_static_var_common(zend_string *var_name, zval *value, u
 	opline = zend_emit_op(NULL, ZEND_BIND_STATIC, NULL, NULL);
 	opline->op1_type = IS_CV;
 	opline->op1.var = lookup_cv(var_name);
+
+	ZEND_STATIC_ASSERT(sizeof(Bucket) % 8 == 0, "Bucket size not compatible with storing flags in lower three bits");
 	opline->extended_value = (uint32_t)((char*)value - (char*)CG(active_op_array)->static_variables->arData) | mode;
 }
 /* }}} */