From a39a2e389a35bb015c5ef357745c337d47ed5775 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Wed, 4 Feb 2026 18:19:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(php):=20=E4=BF=AE=E5=A4=8D=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E5=81=8F=E7=A7=BB=E8=AE=BE=E7=BD=AE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了调试用的 var_dump 语句 - 在数组维度存储解析中正确管理 inAssignExpr 状态 - 修正测试文件中的测试名称描述 --- src/Php/CompilerBase.php | 4 +++- tests/aot/str-offset-set.phpt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index 2cb10054..1883c545 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -1081,7 +1081,6 @@ class CompilerBase extends \PhpAot\Core\Translator $var = $this->parsePropertyFetch($left, true); } elseif ($this->isArrayDimFetch($left)) { $tmp = $this->parseIdentifier($left->var); - var_dump($tmp); if ($this->isVarExpr($left->var) and $this->getVarType($tmp) === self::TYPE_STR) { if ($left->dim === null) { $this->fatalError($left, 'Cannot use [] for strings'); @@ -1720,7 +1719,10 @@ class CompilerBase extends \PhpAot\Core\Translator protected function parseArrayDimStore($array, $dim, $var): string { + $oriInAssignExpr = $this->inAssignExpr; + $this->inAssignExpr = true; $id = $this->parseIdentifier($array); + $this->inAssignExpr = $oriInAssignExpr; return $id . '.offsetSet(' . $this->trimBrackets($dim) . ', ' . $this->trimBrackets($var) . ')'; } diff --git a/tests/aot/str-offset-set.phpt b/tests/aot/str-offset-set.phpt index 6954557c..2d98aa05 100644 --- a/tests/aot/str-offset-set.phpt +++ b/tests/aot/str-offset-set.phpt @@ -1,5 +1,5 @@ --TEST-- -strlen +string offset set --FILE--