From 371422b9b98fd32b64051497aed3738814026d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 29 Jan 2026 10:38:10 +0100 Subject: [PATCH 1/4] Zend/zend_call_stack.h: fix missing include on Windows (clang compat) (#20847) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tim Düsterhus --- NEWS | 3 +++ Zend/zend_call_stack.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/NEWS b/NEWS index d0803cb6dae0c..59d35b5df9475 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,9 @@ PHP NEWS . Fixed bug GH-21055 (connection attribute status typo for GSS negotiation). (lsaos) +- Windows: + . Fixed compilation with clang (missing intrin.h include). (Kévin Dunglas) + 12 Feb 2026, PHP 8.4.18 - Core: diff --git a/Zend/zend_call_stack.h b/Zend/zend_call_stack.h index c8bc756426bf8..566634deeb68a 100644 --- a/Zend/zend_call_stack.h +++ b/Zend/zend_call_stack.h @@ -21,6 +21,9 @@ #include "zend.h" #include "zend_portability.h" +#ifdef _MSC_VER +# include +#endif #ifdef __APPLE__ # include #endif From 23f4b935236e0b811e85f2c8876c04a538ce0c0c Mon Sep 17 00:00:00 2001 From: Giovanni Giacobbi Date: Thu, 29 Jan 2026 11:58:12 +0100 Subject: [PATCH 2/4] gen_stub: Fix compatibility with php 7.4 (in PHP-8.4) (#21076) --- build/gen_stub.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/gen_stub.php b/build/gen_stub.php index 58b846d2cb542..28b168c72642b 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -84,7 +84,7 @@ function processStubFile(string $stubFile, Context $context, bool $includeOnly = } /* Because exit() and die() are proper token/keywords we need to hack-around */ - $hasSpecialExitAsFunctionHandling = str_ends_with($stubFile, 'zend_builtin_functions.stub.php'); + $hasSpecialExitAsFunctionHandling = basename($stubFile) == 'zend_builtin_functions.stub.php'; if (!$fileInfo = $context->parsedFiles[$stubFile] ?? null) { initPhpParser(); $stubContent = $stubCode ?? file_get_contents($stubFile); From 7ec14e3ca412db12e317258e805340fee13dba1d Mon Sep 17 00:00:00 2001 From: Giovanni Giacobbi Date: Thu, 29 Jan 2026 12:01:01 +0100 Subject: [PATCH 3/4] gen_stub: Fix compatibility with php 7.4 (in PHP-8.5+) (#21075) --- build/gen_stub.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/gen_stub.php b/build/gen_stub.php index 4a293972f04ce..57424ac33aa91 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -2235,7 +2235,7 @@ public function __clone() class EvaluatedValue { - public /* readonly */ mixed $value; + public /* readonly */ /* mixed */ $value; public SimpleType $type; public Expr $expr; public bool $isUnknownConstValue; From 2f2b421a485b9b95265b591d90aaabea90d35ec9 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Thu, 29 Jan 2026 00:25:14 +0100 Subject: [PATCH 4/4] Fix segfault when preloading constant AST closure Fixes GH-21059 Closes GH-21071 --- NEWS | 1 + Zend/zend_ast.c | 6 ++++++ ext/opcache/tests/preload_gh21059.inc | 7 +++++++ ext/opcache/tests/preload_gh21059.phpt | 18 ++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 ext/opcache/tests/preload_gh21059.inc create mode 100644 ext/opcache/tests/preload_gh21059.phpt diff --git a/NEWS b/NEWS index dbf94f748827a..8ec869035f0de 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ PHP NEWS - Core: . Fixed bug GH-21029 (zend_mm_heap corrupted on Aarch64, LTO builds). (Arnaud) + . Fixed bug GH-21059 (Segfault when preloading constant AST closure). (ilutov) - Windows: . Fixed compilation with clang (missing intrin.h include). (Kévin Dunglas) diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 9cb3c7aae4a1f..62a4bfec5062d 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -1154,6 +1154,12 @@ ZEND_API zend_result ZEND_FASTCALL zend_ast_evaluate_inner( } case ZEND_AST_OP_ARRAY: { + // Preloading will attempt to resolve constants but objects can't be stored in shm + // Aborting here to store the const AST instead + if (CG(in_compilation)) { + return FAILURE; + } + zend_function *func = (zend_function *)zend_ast_get_op_array(ast)->op_array; zend_create_closure(result, func, scope, scope, NULL); diff --git a/ext/opcache/tests/preload_gh21059.inc b/ext/opcache/tests/preload_gh21059.inc new file mode 100644 index 0000000000000..8f93bb45020bb --- /dev/null +++ b/ext/opcache/tests/preload_gh21059.inc @@ -0,0 +1,7 @@ + +--FILE-- + +--EXPECT-- +Hello world