diff --git a/phpunit/code/variable-variable-arraydim.php b/phpunit/code/variable-variable-arraydim.php new file mode 100644 index 00000000..9a5db13f --- /dev/null +++ b/phpunit/code/variable-variable-arraydim.php @@ -0,0 +1,8 @@ + 'hello']; + ${$foo['bar']} = 'world'; + echo $hello; +} diff --git a/phpunit/src/VariableVariableTest.php b/phpunit/src/VariableVariableTest.php new file mode 100644 index 00000000..f3ae8102 --- /dev/null +++ b/phpunit/src/VariableVariableTest.php @@ -0,0 +1,9 @@ +exec('The `$$` syntax is not supported', 'variable-variable-arraydim.php'); + } +} diff --git a/src/CompilerBase.php b/src/CompilerBase.php index 074a1517..6381503d 100644 --- a/src/CompilerBase.php +++ b/src/CompilerBase.php @@ -1273,7 +1273,7 @@ class CompilerBase implements PropertyAccessContext protected function parseVariable(Variable $expr): string { - if (is_object($expr->name) and $this->isVarExpr($expr->name)) { + if (is_object($expr->name)) { $this->fatalError($expr, 'The `$$` syntax is not supported'); } if ($this->isSuperGlobal($expr->name)) {