@@ -7454,20 +7454,8 @@ void zend_compile_attributes(
74547454 "Cannot use positional argument after named argument" );
74557455 }
74567456
7457- if (target == ZEND_ATTRIBUTE_TARGET_CONST ) {
7458- // Make sure that deprecated constants are not updated
7459- // into protected memory from opcache
7460- zend_ast_ref * ast_copy_ref = zend_ast_copy (args -> child [j ]);
7461- zend_ast * copied_ast = GC_AST (ast_copy_ref );
7462- zend_ast * * extra_ptr = & copied_ast ;
7463- zend_const_expr_to_zval (
7464- & attr -> args [j ].value , extra_ptr , /* allow_dynamic */ true);
7465- zend_ast_destroy (* extra_ptr );
7466- efree (ast_copy_ref );
7467- } else {
7468- zend_const_expr_to_zval (
7469- & attr -> args [j ].value , arg_ast_ptr , /* allow_dynamic */ true);
7470- }
7457+ zend_const_expr_to_zval (
7458+ & attr -> args [j ].value , arg_ast_ptr , /* allow_dynamic */ true);
74717459 }
74727460 }
74737461 }
@@ -9544,12 +9532,17 @@ static void zend_compile_const_decl(zend_ast *ast) /* {{{ */
95449532 "Cannot apply attributes to multiple constants at once"
95459533 );
95469534 }
9535+
9536+ HashTable * attributes = NULL ;
9537+ zend_compile_attributes (& attributes , list -> child [1 ], 0 , ZEND_ATTRIBUTE_TARGET_CONST , 0 );
9538+
95479539 ZEND_ASSERT (last_op != NULL );
95489540 last_op -> opcode = ZEND_DECLARE_ATTRIBUTED_CONST ;
95499541 znode attribs_node ;
95509542 attribs_node .op_type = IS_CONST ;
9551- ZVAL_AST (& attribs_node .u .constant , zend_ast_copy ( list -> child [ 1 ]) );
9543+ ZVAL_PTR (& attribs_node .u .constant , attributes );
95529544 zend_emit_op_data (& attribs_node );
9545+ CG (active_op_array )-> fn_flags |= ZEND_ACC_PTR_OPS ;
95539546}
95549547/* }}}*/
95559548
0 commit comments