From 00023cc3decbb39eabf6c8fc6aece5dd35ef165c Mon Sep 17 00:00:00 2001 From: Yurun Date: Sun, 19 Jul 2026 08:55:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(compiler):=20=E6=8B=92=E7=BB=9D=E6=89=80?= =?UTF-8?q?=E6=9C=89$$=E8=AF=AD=E6=B3=95=E8=80=8C=E9=9D=9E=E4=BB=85?= =?UTF-8?q?=E7=89=B9=E5=AE=9A=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpunit/code/variable-variable-arraydim.php | 8 ++++++++ phpunit/src/VariableVariableTest.php | 9 +++++++++ src/CompilerBase.php | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 phpunit/code/variable-variable-arraydim.php create mode 100644 phpunit/src/VariableVariableTest.php 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)) {