@@ -2371,6 +2371,10 @@ static inline void zend_emit_assign_znode(zend_ast *var_ast, znode *value_node)
2371
2371
2372
2372
static zend_op * zend_delayed_compile_dim (znode * result , zend_ast * ast , uint32_t type ) /* {{{ */
2373
2373
{
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
+
2374
2378
zend_ast * var_ast = ast -> child [0 ];
2375
2379
zend_ast * dim_ast = ast -> child [1 ];
2376
2380
zend_op * opline ;
@@ -8745,7 +8749,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
8745
8749
case ZEND_AST_COALESCE :
8746
8750
/* Set isset fetch indicator here, opcache disallows runtime altering of the AST */
8747
8751
if (ast -> child [0 ]-> kind == ZEND_AST_DIM ) {
8748
- ast -> child [0 ]-> attr = ZEND_DIM_IS ;
8752
+ ast -> child [0 ]-> attr | = ZEND_DIM_IS ;
8749
8753
}
8750
8754
zend_eval_const_expr (& ast -> child [0 ]);
8751
8755
@@ -8799,9 +8803,14 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
8799
8803
zend_error_noreturn (E_COMPILE_ERROR , "Cannot use [] for reading" );
8800
8804
}
8801
8805
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
+
8802
8811
/* 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 ;
8805
8814
}
8806
8815
8807
8816
zend_eval_const_expr (& ast -> child [0 ]);
0 commit comments