Commit dcdc8ab02ca for php.net
commit dcdc8ab02caf91a4d27c95ab3cd03a9aa00191a2
Author: Kuba Werłos <werlos@gmail.com>
Date: Wed Aug 19 11:35:00 2026 +0200
Prevent inlining of `zend_compile_expr_inner()` to guarantee low stack usage of compilation (#23294)
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index f3527330a2c..317114265c5 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -12447,7 +12447,9 @@ static void zend_compile_stmt(zend_ast *ast) /* {{{ */
}
/* }}} */
-static void zend_compile_expr_inner(znode *result, zend_ast *ast) /* {{{ */
+/* Keep this out of zend_compile_expr(): the two form a recursion cycle, so inlining merges this
+ * frame into every nesting level of an expression, tripling the stack needed to compile it. */
+static zend_never_inline void zend_compile_expr_inner(znode *result, zend_ast *ast) /* {{{ */
{
/* CG(zend_lineno) = ast->lineno; */
CG(zend_lineno) = zend_ast_get_lineno(ast);