Skip to content

Commit 94f42ef

Browse files
committed
Fix Opcache file cache
1 parent 1310748 commit 94f42ef

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

ext/opcache/zend_file_cache.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,6 @@ static void zend_file_cache_serialize_hash(HashTable *ht,
343343
}
344344
}
345345

346-
static void zend_file_cache_serialize_func(zval *zv,
347-
zend_persistent_script *script,
348-
zend_file_cache_metainfo *info,
349-
void *buf);
350-
351346
static void zend_file_cache_serialize_ast(zend_ast *ast,
352347
zend_persistent_script *script,
353348
zend_file_cache_metainfo *info,
@@ -369,7 +364,8 @@ static void zend_file_cache_serialize_ast(zend_ast *ast,
369364
}
370365
}
371366
} else if (ast->kind == ZEND_AST_OP_ARRAY) {
372-
zend_file_cache_serialize_func(&((zend_ast_zval*)ast)->val, script, info, buf);
367+
/* The op_array itself will be serialized as part of the dynamic_func_defs. */
368+
SERIALIZE_PTR(Z_PTR(((zend_ast_zval*)ast)->val));
373369
} else {
374370
uint32_t children = zend_ast_get_num_children(ast);
375371
for (i = 0; i < children; i++) {
@@ -475,7 +471,7 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
475471

476472
/* Check whether this op_array has already been serialized. */
477473
if (IS_SERIALIZED(op_array->opcodes)) {
478-
// ZEND_ASSERT(op_array->scope && "Only method op_arrays should be shared");
474+
ZEND_ASSERT(op_array->scope && "Only method op_arrays should be shared");
479475
return;
480476
}
481477

@@ -1233,10 +1229,6 @@ static void zend_file_cache_unserialize_hash(HashTable *ht,
12331229
}
12341230
}
12351231

1236-
static void zend_file_cache_unserialize_func(zval *zv,
1237-
zend_persistent_script *script,
1238-
void *buf);
1239-
12401232
static void zend_file_cache_unserialize_ast(zend_ast *ast,
12411233
zend_persistent_script *script,
12421234
void *buf)
@@ -1254,7 +1246,8 @@ static void zend_file_cache_unserialize_ast(zend_ast *ast,
12541246
}
12551247
}
12561248
} else if (ast->kind == ZEND_AST_OP_ARRAY) {
1257-
zend_file_cache_unserialize_func(&((zend_ast_zval*)ast)->val, script, buf);
1249+
/* The op_array itself will be unserialized as part of the dynamic_func_defs. */
1250+
UNSERIALIZE_PTR(Z_PTR(((zend_ast_zval*)ast)->val));
12581251
} else {
12591252
uint32_t children = zend_ast_get_num_children(ast);
12601253
for (i = 0; i < children; i++) {
@@ -1368,7 +1361,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
13681361

13691362
/* Check whether this op_array has already been unserialized. */
13701363
if (IS_UNSERIALIZED(op_array->opcodes)) {
1371-
//ZEND_ASSERT(op_array->scope && "Only method op_arrays should be shared");
1364+
ZEND_ASSERT(op_array->scope && "Only method op_arrays should be shared");
13721365
return;
13731366
}
13741367

0 commit comments

Comments
 (0)