From 3df8a36674793eb081dc22b45258a4061f1b55df Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Tue, 17 Mar 2026 19:32:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(php):=20=E4=BF=AE=E5=A4=8D=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E5=99=A8=E5=9F=BA=E7=A1=80=E7=B1=BB=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E9=87=8D=E7=BD=AE=E5=92=8C=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在resetFunction方法中添加objects数组的重置 - 更新错误消息以提供更详细的原生方法查找失败信息 - 修正错误消息中包含类名和方法名的格式 --- src/Php/CompilerBase.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index 8d85907a..8d88ec41 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -574,16 +574,17 @@ class CompilerBase extends \PhpAot\Core\Translator protected function resetFunction(): void { - $this->localVars = []; - $this->staticVars = []; - $this->arguments = []; + $this->localVars = []; + $this->staticVars = []; + $this->arguments = []; + $this->objects = []; $this->objectWrappers = []; - $this->ceWrappers = []; - $this->tmpVarIndex = 0; - $this->inLoop = false; - $this->function = ''; - $this->functionDef = null; - $this->inClosure = false; + $this->ceWrappers = []; + $this->tmpVarIndex = 0; + $this->inLoop = false; + $this->function = ''; + $this->functionDef = null; + $this->inClosure = false; } protected function resetMethod(): void @@ -1607,7 +1608,7 @@ class CompilerBase extends \PhpAot\Core\Translator return false; } if (!$this->hasNativeClass($classDef->extends)) { - $this->climate->error('Class `' . $classDef->extends . '` is not defined'); + $this->climate->error('Native method `' . $class . '::' . $method . '()` not found, the parent class `' . $classDef->extends . '` is not defined'); return false; } $classDef = $this->getClassDef($classDef->extends);