Skip to content

Commit 551038b

Browse files
authored
zend_compile: Fully remove ZEND_DIM_ALTERNATIVE_SYNTAX (#14974)
This flag is longer set since the merge of property hooks in 780a828. This patch removes it completely, because the corresponding error messages are unreachable.
1 parent a4c867e commit 551038b

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

Zend/zend_compile.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3026,9 +3026,6 @@ static inline void zend_emit_assign_znode(zend_ast *var_ast, znode *value_node)
30263026

30273027
static zend_op *zend_delayed_compile_dim(znode *result, zend_ast *ast, uint32_t type, bool by_ref)
30283028
{
3029-
if (ast->attr == ZEND_DIM_ALTERNATIVE_SYNTAX) {
3030-
zend_error(E_COMPILE_ERROR, "Array and string offset access syntax with curly braces is no longer supported");
3031-
}
30323029
zend_ast *var_ast = ast->child[0];
30333030
zend_ast *dim_ast = ast->child[1];
30343031
zend_op *opline;
@@ -11763,11 +11760,6 @@ static void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
1176311760
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading");
1176411761
}
1176511762

11766-
if (ast->attr & ZEND_DIM_ALTERNATIVE_SYNTAX) {
11767-
ast->attr &= ~ZEND_DIM_ALTERNATIVE_SYNTAX; /* remove flag to avoid duplicate warning */
11768-
zend_error(E_COMPILE_ERROR, "Array and string offset access syntax with curly braces is no longer supported");
11769-
}
11770-
1177111763
/* Set isset fetch indicator here, opcache disallows runtime altering of the AST */
1177211764
if ((ast->attr & ZEND_DIM_IS) && ast->child[0]->kind == ZEND_AST_DIM) {
1177311765
ast->child[0]->attr |= ZEND_DIM_IS;

Zend/zend_compile.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,11 +1090,10 @@ ZEND_API zend_string *zend_type_to_string(zend_type type);
10901090
((ZEND_TYPE_FULL_MASK((arg_info)->type) & _ZEND_IS_TENTATIVE_BIT) != 0)
10911091

10921092
#define ZEND_DIM_IS (1 << 0) /* isset fetch needed for null coalesce. Set in zend_compile.c for ZEND_AST_DIM nested within ZEND_AST_COALESCE. */
1093-
#define ZEND_DIM_ALTERNATIVE_SYNTAX (1 << 1) /* deprecated curly brace usage */
10941093

10951094
/* Attributes for ${} encaps var in strings (ZEND_AST_DIM or ZEND_AST_VAR node) */
10961095
/* ZEND_AST_VAR nodes can have any of the ZEND_ENCAPS_VAR_* flags */
1097-
/* ZEND_AST_DIM flags can have ZEND_DIM_ALTERNATIVE_SYNTAX or ZEND_ENCAPS_VAR_DOLLAR_CURLY during the parse phase (ZEND_DIM_ALTERNATIVE_SYNTAX is a thrown fatal error). */
1096+
/* ZEND_AST_DIM flags can have ZEND_ENCAPS_VAR_DOLLAR_CURLY during the parse phase. */
10981097
#define ZEND_ENCAPS_VAR_DOLLAR_CURLY (1 << 0)
10991098
#define ZEND_ENCAPS_VAR_DOLLAR_CURLY_VAR_VAR (1 << 1)
11001099

0 commit comments

Comments
 (0)