diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index cd8e6792d031f..764cac3f12af2 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -1247,6 +1247,12 @@ static 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/Zend/zend_call_stack.h b/Zend/zend_call_stack.h index fee528c150f08..58e91694f93f2 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 diff --git a/build/gen_stub.php b/build/gen_stub.php index 9cd9b9a18768c..2670e85458dba 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; 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