@@ -2371,6 +2371,10 @@ static inline void zend_emit_assign_znode(zend_ast *var_ast, znode *value_node)
23712371
23722372static zend_op * zend_delayed_compile_dim (znode * result , zend_ast * ast , uint32_t type ) /* {{{ */
23732373{
2374+ if (ast -> attr == ZEND_DIM_ALTERNATIVE_SYNTAX ) {
2375+ zend_error (E_DEPRECATED , "Array and string offset access syntax with curly braces is deprecated" );
2376+ }
2377+
23742378 zend_ast * var_ast = ast -> child [0 ];
23752379 zend_ast * dim_ast = ast -> child [1 ];
23762380 zend_op * opline ;
@@ -8745,7 +8749,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
87458749 case ZEND_AST_COALESCE :
87468750 /* Set isset fetch indicator here, opcache disallows runtime altering of the AST */
87478751 if (ast -> child [0 ]-> kind == ZEND_AST_DIM ) {
8748- ast -> child [0 ]-> attr = ZEND_DIM_IS ;
8752+ ast -> child [0 ]-> attr | = ZEND_DIM_IS ;
87498753 }
87508754 zend_eval_const_expr (& ast -> child [0 ]);
87518755
@@ -8799,9 +8803,14 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
87998803 zend_error_noreturn (E_COMPILE_ERROR , "Cannot use [] for reading" );
88008804 }
88018805
8806+ if (ast -> attr & ZEND_DIM_ALTERNATIVE_SYNTAX ) {
8807+ ast -> attr &= ~ZEND_DIM_ALTERNATIVE_SYNTAX ; /* remove flag to avoid duplicate warning */
8808+ zend_error (E_DEPRECATED , "Array and string offset access syntax with curly braces is deprecated" );
8809+ }
8810+
88028811 /* Set isset fetch indicator here, opcache disallows runtime altering of the AST */
8803- if (ast -> attr == ZEND_DIM_IS && ast -> child [0 ]-> kind == ZEND_AST_DIM ) {
8804- ast -> child [0 ]-> attr = ZEND_DIM_IS ;
8812+ if (ast -> attr & ZEND_DIM_IS && ast -> child [0 ]-> kind == ZEND_AST_DIM ) {
8813+ ast -> child [0 ]-> attr | = ZEND_DIM_IS ;
88058814 }
88068815
88078816 zend_eval_const_expr (& ast -> child [0 ]);
0 commit comments