@@ -1308,6 +1308,7 @@ static void zend_file_cache_unserialize_ast(zend_ast *ast,
13081308 zend_ast_get_op_array (ast )-> op_array = Z_PTR (z );
13091309 } else if (ast -> kind == ZEND_AST_CALLABLE_CONVERT ) {
13101310 zend_ast_fcc * fcc = (zend_ast_fcc * )ast ;
1311+ fcc -> declaring_op_array = CG (active_op_array );
13111312 ZEND_MAP_PTR_NEW (fcc -> fptr );
13121313 if (!IS_UNSERIALIZED (fcc -> args )) {
13131314 UNSERIALIZE_PTR (fcc -> args );
@@ -1414,6 +1415,9 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
14141415 zend_persistent_script * script ,
14151416 void * buf )
14161417{
1418+ zend_op_array * orig_op_array = CG (active_op_array );
1419+ CG (active_op_array ) = op_array ;
1420+
14171421 if (!script -> corrupted ) {
14181422 if (op_array != & script -> script .main_op_array ) {
14191423 op_array -> fn_flags |= ZEND_ACC_IMMUTABLE ;
@@ -1434,7 +1438,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
14341438 /* Check whether this op_array has already been unserialized. */
14351439 if (IS_UNSERIALIZED (op_array -> opcodes )) {
14361440 ZEND_ASSERT (op_array -> scope && "Only method op_arrays should be shared" );
1437- return ;
1441+ goto end ;
14381442 }
14391443
14401444 if (op_array -> refcount ) {
@@ -1453,7 +1457,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
14531457 UNSERIALIZE_PTR (op_array -> try_catch_array );
14541458 UNSERIALIZE_PTR (op_array -> prototype );
14551459 UNSERIALIZE_PTR (op_array -> prop_info );
1456- return ;
1460+ goto end ;
14571461 }
14581462
14591463 if (op_array -> static_variables ) {
@@ -1597,6 +1601,9 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
15971601 UNSERIALIZE_PTR (op_array -> prototype );
15981602 UNSERIALIZE_PTR (op_array -> prop_info );
15991603 }
1604+
1605+ end :
1606+ CG (active_op_array ) = orig_op_array ;
16001607}
16011608
16021609static void zend_file_cache_unserialize_func (zval * zv ,
@@ -1888,6 +1895,9 @@ static void zend_file_cache_unserialize(zend_persistent_script *script,
18881895{
18891896 script -> mem = buf ;
18901897
1898+ zend_op_array * orig_op_array = CG (active_op_array );
1899+ CG (active_op_array ) = & script -> script .main_op_array ;
1900+
18911901 UNSERIALIZE_STR (script -> script .filename );
18921902
18931903 zend_file_cache_unserialize_hash (& script -> script .class_table ,
@@ -1897,6 +1907,8 @@ static void zend_file_cache_unserialize(zend_persistent_script *script,
18971907 zend_file_cache_unserialize_op_array (& script -> script .main_op_array , script , buf );
18981908 zend_file_cache_unserialize_warnings (script , buf );
18991909 zend_file_cache_unserialize_early_bindings (script , buf );
1910+
1911+ CG (active_op_array ) = orig_op_array ;
19001912}
19011913
19021914static zend_persistent_script file_cache_validate_success_script ;
0 commit comments