@@ -640,10 +640,16 @@ static void zend_persist_op_array(zval *zv)
640640 ZEND_ASSERT (op_array -> type == ZEND_USER_FUNCTION );
641641 op_array = Z_PTR_P (zv ) = zend_shared_memdup (Z_PTR_P (zv ), sizeof (zend_op_array ));
642642 zend_persist_op_array_ex (op_array , NULL );
643- op_array -> fn_flags |= ZEND_ACC_IMMUTABLE ;
644- ZEND_MAP_PTR_NEW (op_array -> run_time_cache );
645- if (op_array -> static_variables ) {
646- ZEND_MAP_PTR_NEW (op_array -> static_variables_ptr );
643+ if (!ZCG (current_persistent_script )-> corrupted ) {
644+ op_array -> fn_flags |= ZEND_ACC_IMMUTABLE ;
645+ ZEND_MAP_PTR_NEW (op_array -> run_time_cache );
646+ if (op_array -> static_variables ) {
647+ ZEND_MAP_PTR_NEW (op_array -> static_variables_ptr );
648+ }
649+ } else {
650+ ZEND_MAP_PTR_INIT (op_array -> run_time_cache , ZCG (arena_mem ));
651+ ZCG (arena_mem ) = (void * )(((char * )ZCG (arena_mem )) + ZEND_ALIGNED_SIZE (sizeof (void * )));
652+ ZEND_MAP_PTR_SET (op_array -> run_time_cache , NULL );
647653 }
648654}
649655
@@ -776,7 +782,8 @@ static void zend_persist_class_entry(zval *zv)
776782
777783 if (ce -> type == ZEND_USER_CLASS ) {
778784 if ((ce -> ce_flags & ZEND_ACC_LINKED )
779- && (ce -> ce_flags & ZEND_ACC_CONSTANTS_UPDATED )) {
785+ && (ce -> ce_flags & ZEND_ACC_CONSTANTS_UPDATED )
786+ && !ZCG (current_persistent_script )-> corrupted ) {
780787 ZCG (is_immutable_class ) = 1 ;
781788 ce = Z_PTR_P (zv ) = zend_shared_memdup_put (ce , sizeof (zend_class_entry ));
782789 ce -> ce_flags |= ZEND_ACC_IMMUTABLE ;
0 commit comments