From d1c56ee5d14f14ade1965febc852cbe8e7f5a72c Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Fri, 23 Jan 2026 18:44:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(php):=20=E4=BF=AE=E5=A4=8D=E8=B5=8B?= =?UTF-8?q?=E5=80=BC=E8=A1=A8=E8=BE=BE=E5=BC=8F=E4=BD=9C=E4=B8=BA=E5=8F=B3?= =?UTF-8?q?=E5=80=BC=E6=97=B6=E7=9A=84=E8=A7=A3=E6=9E=90=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加了对 Expr_Assign 和 Expr_AssignRef 节点类型的处理 - 验证赋值表达式的变量部分是否为有效变量表达式 - 当赋值表达式作为右值使用时确保其为变量赋值 - 添加了相应的错误提示信息 --- src/Php/CompilerBase.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index 9561e507..70dadd73 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -387,6 +387,12 @@ class CompilerBase extends \PhpAot\Core\Translator return $this->parseScalar($expr); case 'Expr_ConstFetch': return $this->parseConstFetch($expr); + case 'Expr_Assign': + case 'Expr_AssignRef': + if (!$this->isVarExpr($expr->var)) { + $this->fatalError($expr, 'When an assignment expression serves as an rvalue, it must be an assignment of a variable'); + } + return $this->parseExpr($expr); default: return $this->parseExpr($expr); }