mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-30 04:29:15 +01:00
Disallow array deref using alternative syntax
f(){0} and a::b(){0} aren't allowed anymore (in compliance with PHP). $a->b(){0} support stays for now (for technical reason).
This commit is contained in:
parent
fa5f9e0740
commit
1449cc2092
@ -602,7 +602,7 @@ function_call:
|
||||
| variable_without_objects '(' argument_list ')'
|
||||
{ $$ = Expr_FuncCall[$1, $3]; }
|
||||
| function_call '[' dim_offset ']' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
| function_call '{' expr '}' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
/* alternative array syntax missing intentionally */
|
||||
;
|
||||
|
||||
class_name:
|
||||
@ -724,6 +724,7 @@ variable:
|
||||
new_expr_array_deref:
|
||||
'(' new_expr ')' '[' dim_offset ']' { $$ = Expr_ArrayDimFetch[$2, $5]; }
|
||||
| new_expr_array_deref '[' dim_offset ']' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
/* alternative array syntax missing intentionally */
|
||||
;
|
||||
|
||||
object_access:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,7 +13,6 @@ $a{'b'}();
|
||||
|
||||
// array dereferencing
|
||||
a()['b'];
|
||||
a(){'b'}; // this is invalid PHP. Remove?
|
||||
-----
|
||||
array(
|
||||
0: Expr_FuncCall(
|
||||
@ -99,18 +98,4 @@ array(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
8: Expr_ArrayDimFetch(
|
||||
var: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: a
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
@ -11,7 +11,6 @@ A::$b['c']['d']();
|
||||
|
||||
// array dereferencing
|
||||
A::b()['c'];
|
||||
A::b(){'c'}; // this is invalid PHP. Remove?
|
||||
|
||||
// class name variations
|
||||
static::b();
|
||||
@ -108,22 +107,7 @@ array(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
6: Expr_ArrayDimFetch(
|
||||
var: Expr_StaticCall(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: b
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
7: Expr_StaticCall(
|
||||
6: Expr_StaticCall(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: static
|
||||
@ -133,7 +117,7 @@ array(
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
8: Expr_StaticCall(
|
||||
7: Expr_StaticCall(
|
||||
class: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
@ -141,7 +125,7 @@ array(
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
9: Expr_StaticCall(
|
||||
8: Expr_StaticCall(
|
||||
class: Expr_Variable(
|
||||
name: Scalar_String(
|
||||
value: a
|
||||
@ -151,7 +135,7 @@ array(
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
10: Expr_StaticCall(
|
||||
9: Expr_StaticCall(
|
||||
class: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
|
Loading…
Reference in New Issue
Block a user