Skip to content

Commit 76b02be

Browse files
committed
Remove depreacted curly brace offset syntax
1 parent 06750d7 commit 76b02be

File tree

6 files changed

+1
-52
lines changed

6 files changed

+1
-52
lines changed

Zend/tests/036.phpt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,7 @@ try {
88
} catch (Error $e) {
99
echo $e->getMessage(), "\n";
1010
}
11-
try {
12-
$a{function() { }} = 1;
13-
} catch (Error $e) {
14-
echo $e->getMessage(), "\n";
15-
}
1611

1712
?>
18-
--EXPECTF--
19-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s on line %d
20-
Illegal offset type
13+
--EXPECT--
2114
Illegal offset type

Zend/tests/constant_expressions_coalesce.phpt

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,13 @@ Constant expressions with null coalescing operator ??
55

66
const A = [1 => [[]]];
77

8-
// should produce deprecation notices
9-
const D_1 = null ?? A[1]{'undefined'}['index'] ?? 1;
10-
const D_2 = null ?? A['undefined']{'index'} ?? 2;
11-
const D_3 = null ?? A[1]{0}{2} ?? 3; // 2 deprecation notices
12-
const D_4 = A[1]{0} ?? 4;
13-
148
const T_1 = null ?? A[1]['undefined']['index'] ?? 1;
159
const T_2 = null ?? A['undefined']['index'] ?? 2;
1610
const T_3 = null ?? A[1][0][2] ?? 3;
1711
const T_4 = A[1][0][2] ?? 4;
1812
const T_5 = null ?? __LINE__;
1913
const T_6 = __LINE__ ?? "bar";
2014

21-
var_dump(D_1);
22-
var_dump(D_2);
23-
var_dump(D_3);
24-
var_dump(D_4);
25-
2615
var_dump(T_1);
2716
var_dump(T_2);
2817
var_dump(T_3);
@@ -42,21 +31,6 @@ var_dump((new class { public $var = A[1][0][2] ?? 4; })->var);
4231

4332
?>
4433
--EXPECTF--
45-
46-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
47-
48-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
49-
50-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
51-
52-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
53-
54-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
55-
int(1)
56-
int(2)
57-
int(3)
58-
array(0) {
59-
}
6034
int(1)
6135
int(2)
6236
int(3)

Zend/tests/varSyntax/newVariable.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,13 @@ $weird = [0 => (object) ['foo' => 'Test']];
1515

1616
var_dump(new $className);
1717
var_dump(new $array['className']);
18-
var_dump(new $array{'className'});
1918
var_dump(new $obj->className);
2019
var_dump(new Test::$className);
2120
var_dump(new $test::$className);
2221
var_dump(new $weird[0]->foo::$className);
2322

2423
?>
2524
--EXPECTF--
26-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s on line %d
27-
object(stdClass)#%d (0) {
28-
}
2925
object(stdClass)#%d (0) {
3026
}
3127
object(stdClass)#%d (0) {

Zend/zend_compile.c

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

26312631
static zend_op *zend_delayed_compile_dim(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
26322632
{
2633-
if (ast->attr == ZEND_DIM_ALTERNATIVE_SYNTAX) {
2634-
zend_error(E_DEPRECATED, "Array and string offset access syntax with curly braces is deprecated");
2635-
}
2636-
26372633
zend_ast *var_ast = ast->child[0];
26382634
zend_ast *dim_ast = ast->child[1];
26392635
zend_op *opline;
@@ -9135,11 +9131,6 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
91359131
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading");
91369132
}
91379133

9138-
if (ast->attr & ZEND_DIM_ALTERNATIVE_SYNTAX) {
9139-
ast->attr &= ~ZEND_DIM_ALTERNATIVE_SYNTAX; /* remove flag to avoid duplicate warning */
9140-
zend_error(E_DEPRECATED, "Array and string offset access syntax with curly braces is deprecated");
9141-
}
9142-
91439134
/* Set isset fetch indicator here, opcache disallows runtime altering of the AST */
91449135
if (ast->attr & ZEND_DIM_IS && ast->child[0]->kind == ZEND_AST_DIM) {
91459136
ast->child[0]->attr |= ZEND_DIM_IS;

Zend/zend_compile.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,6 @@ ZEND_API zend_string *zend_type_to_string(zend_type type);
931931
((ZEND_TYPE_FULL_MASK((arg_info)->type) & _ZEND_IS_VARIADIC_BIT) != 0)
932932

933933
#define ZEND_DIM_IS (1 << 0) /* isset fetch needed for null coalesce */
934-
#define ZEND_DIM_ALTERNATIVE_SYNTAX (1 << 1) /* deprecated curly brace usage */
935934

936935
/* Make sure these don't clash with ZEND_FETCH_CLASS_* flags. */
937936
#define IS_CONSTANT_CLASS 0x400 /* __CLASS__ in trait */

Zend/zend_language_parser.y

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,8 +1191,6 @@ callable_variable:
11911191
{ $$ = zend_ast_create(ZEND_AST_VAR, $1); }
11921192
| array_object_dereferencable '[' optional_expr ']'
11931193
{ $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
1194-
| array_object_dereferencable '{' expr '}'
1195-
{ $$ = zend_ast_create_ex(ZEND_AST_DIM, ZEND_DIM_ALTERNATIVE_SYNTAX, $1, $3); }
11961194
| array_object_dereferencable T_OBJECT_OPERATOR property_name argument_list
11971195
{ $$ = zend_ast_create(ZEND_AST_METHOD_CALL, $1, $3, $4); }
11981196
| function_call { $$ = $1; }
@@ -1225,8 +1223,6 @@ new_variable:
12251223
{ $$ = zend_ast_create(ZEND_AST_VAR, $1); }
12261224
| new_variable '[' optional_expr ']'
12271225
{ $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
1228-
| new_variable '{' expr '}'
1229-
{ $$ = zend_ast_create_ex(ZEND_AST_DIM, ZEND_DIM_ALTERNATIVE_SYNTAX, $1, $3); }
12301226
| new_variable T_OBJECT_OPERATOR property_name
12311227
{ $$ = zend_ast_create(ZEND_AST_PROP, $1, $3); }
12321228
| class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable

0 commit comments

Comments
 (0)