Skip to content

Commit 92b2887

Browse files
authored
Fix handling of ZEND_AST_CALLABLE_CONVERT in file cache (#20860)
Nodes in zend_ast_fcc->args were serialized, but not zend_ast_fcc->args itself
1 parent 643cf62 commit 92b2887

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ext/opcache/zend_file_cache.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,12 @@ static void zend_file_cache_serialize_ast(zend_ast *ast,
384384
} else if (ast->kind == ZEND_AST_CALLABLE_CONVERT) {
385385
zend_ast_fcc *fcc = (zend_ast_fcc*)ast;
386386
ZEND_MAP_PTR_INIT(fcc->fptr, NULL);
387-
zend_file_cache_serialize_ast(fcc->args, script, info, buf);
387+
if (!IS_SERIALIZED(fcc->args)) {
388+
SERIALIZE_PTR(fcc->args);
389+
tmp = fcc->args;
390+
UNSERIALIZE_PTR(tmp);
391+
zend_file_cache_serialize_ast(tmp, script, info, buf);
392+
}
388393
} else if (zend_ast_is_decl(ast)) {
389394
/* Not implemented. */
390395
ZEND_UNREACHABLE();
@@ -1305,7 +1310,10 @@ static void zend_file_cache_unserialize_ast(zend_ast *ast,
13051310
} else if (ast->kind == ZEND_AST_CALLABLE_CONVERT) {
13061311
zend_ast_fcc *fcc = (zend_ast_fcc*)ast;
13071312
ZEND_MAP_PTR_NEW(fcc->fptr);
1308-
zend_file_cache_unserialize_ast(fcc->args, script, buf);
1313+
if (!IS_UNSERIALIZED(fcc->args)) {
1314+
UNSERIALIZE_PTR(fcc->args);
1315+
zend_file_cache_unserialize_ast(fcc->args, script, buf);
1316+
}
13091317
} else if (zend_ast_is_decl(ast)) {
13101318
/* Not implemented. */
13111319
ZEND_UNREACHABLE();

0 commit comments

Comments
 (0)