File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -8306,12 +8306,6 @@ static zend_op_array *zend_compile_func_decl_ex(
83068306
83078307 if (decl -> kind == ZEND_AST_CLOSURE || decl -> kind == ZEND_AST_ARROW_FUNC ) {
83088308 op_array -> fn_flags |= ZEND_ACC_CLOSURE ;
8309- /* Set the closure scope at compile time as an optimization to
8310- * prevent creating a separate runtime cache for every initialization
8311- * of this closure. Most closures are expected not to change their
8312- * scope in practice.
8313- */
8314- op_array -> scope = CG (active_class_entry );
83158309 }
83168310
83178311 if (is_hook ) {
@@ -8468,6 +8462,15 @@ static zend_op_array *zend_compile_func_decl_ex(
84688462 /* Pop the loop variable stack separator */
84698463 zend_stack_del_top (& CG (loop_var_stack ));
84708464
8465+ if (op_array -> fn_flags & ZEND_ACC_CLOSURE ) {
8466+ /* Set the closure scope at compile time as an optimization to
8467+ * prevent creating a separate runtime cache for every initialization
8468+ * of this closure. Most closures are expected not to change their
8469+ * scope in practice.
8470+ */
8471+ op_array -> scope = CG (active_class_entry );
8472+ }
8473+
84718474 if (level == FUNC_DECL_LEVEL_TOPLEVEL ) {
84728475 zend_observer_function_declared_notify (op_array , lcname );
84738476 }
You can’t perform that action at this time.
0 commit comments