Skip to content

Commit b0327b9

Browse files
committed
Remove depreacted curly brace offset syntax
1 parent b452d59 commit b0327b9

File tree

8 files changed

+2
-91
lines changed

8 files changed

+2
-91
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
@@ -2613,10 +2613,6 @@ static inline void zend_emit_assign_znode(zend_ast *var_ast, znode *value_node)
26132613

26142614
static zend_op *zend_delayed_compile_dim(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
26152615
{
2616-
if (ast->attr == ZEND_DIM_ALTERNATIVE_SYNTAX) {
2617-
zend_error(E_DEPRECATED, "Array and string offset access syntax with curly braces is deprecated");
2618-
}
2619-
26202616
zend_ast *var_ast = ast->child[0];
26212617
zend_ast *dim_ast = ast->child[1];
26222618
zend_op *opline;
@@ -9150,11 +9146,6 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
91509146
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading");
91519147
}
91529148

9153-
if (ast->attr & ZEND_DIM_ALTERNATIVE_SYNTAX) {
9154-
ast->attr &= ~ZEND_DIM_ALTERNATIVE_SYNTAX; /* remove flag to avoid duplicate warning */
9155-
zend_error(E_DEPRECATED, "Array and string offset access syntax with curly braces is deprecated");
9156-
}
9157-
91589149
/* Set isset fetch indicator here, opcache disallows runtime altering of the AST */
91599150
if (ast->attr & ZEND_DIM_IS && ast->child[0]->kind == ZEND_AST_DIM) {
91609151
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
@@ -938,7 +938,6 @@ ZEND_API zend_string *zend_type_to_string(zend_type type);
938938
((ZEND_TYPE_FULL_MASK((arg_info)->type) & _ZEND_IS_VARIADIC_BIT) != 0)
939939

940940
#define ZEND_DIM_IS (1 << 0) /* isset fetch needed for null coalesce */
941-
#define ZEND_DIM_ALTERNATIVE_SYNTAX (1 << 1) /* deprecated curly brace usage */
942941

943942
/* Make sure these don't clash with ZEND_FETCH_CLASS_* flags. */
944943
#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
@@ -1192,8 +1192,6 @@ callable_variable:
11921192
{ $$ = zend_ast_create(ZEND_AST_VAR, $1); }
11931193
| array_object_dereferencable '[' optional_expr ']'
11941194
{ $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
1195-
| array_object_dereferencable '{' expr '}'
1196-
{ $$ = zend_ast_create_ex(ZEND_AST_DIM, ZEND_DIM_ALTERNATIVE_SYNTAX, $1, $3); }
11971195
| array_object_dereferencable T_OBJECT_OPERATOR property_name argument_list
11981196
{ $$ = zend_ast_create(ZEND_AST_METHOD_CALL, $1, $3, $4); }
11991197
| function_call { $$ = $1; }
@@ -1226,8 +1224,6 @@ new_variable:
12261224
{ $$ = zend_ast_create(ZEND_AST_VAR, $1); }
12271225
| new_variable '[' optional_expr ']'
12281226
{ $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
1229-
| new_variable '{' expr '}'
1230-
{ $$ = zend_ast_create_ex(ZEND_AST_DIM, ZEND_DIM_ALTERNATIVE_SYNTAX, $1, $3); }
12311227
| new_variable T_OBJECT_OPERATOR property_name
12321228
{ $$ = zend_ast_create(ZEND_AST_PROP, $1, $3); }
12331229
| class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable

ext/iconv/tests/eucjp2iso2022jp.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ error_reporting=2039
1111
function hexdump($str) {
1212
$len = strlen($str);
1313
for ($i = 0; $i < $len; ++$i) {
14-
printf("%02x", ord($str{$i}));
14+
printf("%02x", ord($str[$i]));
1515
}
1616
print "\n";
1717
}

tests/strings/offsets_general.phpt

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,8 @@ var_dump(isset($string[0][0]));
1212
var_dump($string["foo"]);
1313
var_dump(isset($string["foo"]["bar"]));
1414

15-
const FOO_DEPRECATED = "BAR"{0};
16-
var_dump(FOO_DEPRECATED);
17-
var_dump([$string{0}]); // 1 notice
18-
var_dump($string{1});
19-
var_dump(isset($string{0}));
20-
var_dump(isset($string{0}{0})); // 2 notices
21-
var_dump($string{"foo"});
22-
var_dump(isset($string{"foo"}{"bar"})); // 2 notices
2315
?>
2416
--EXPECTF--
25-
26-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
27-
28-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
29-
30-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
31-
32-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
33-
34-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
35-
36-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
37-
38-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
39-
40-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
41-
42-
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
4317
string(1) "B"
4418
string(1) "f"
4519
string(1) "o"
@@ -49,15 +23,3 @@ bool(true)
4923
Warning: Illegal string offset 'foo' in %s line %d
5024
string(1) "f"
5125
bool(false)
52-
string(1) "B"
53-
array(1) {
54-
[0]=>
55-
string(1) "f"
56-
}
57-
string(1) "o"
58-
bool(true)
59-
bool(true)
60-
61-
Warning: Illegal string offset 'foo' in %s line %d
62-
string(1) "f"
63-
bool(false)

0 commit comments

Comments
 (0)