From 057e25712d4597e449947a9d06118d87e504339b Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Tue, 31 Mar 2026 20:38:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(php):=20=E4=BF=AE=E5=A4=8D=E7=B1=BB?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=92=8C=E5=B8=B8=E9=87=8F=E6=9F=A5=E6=89=BE?= =?UTF-8?q?=E7=9A=84=E6=97=A0=E9=99=90=E5=BE=AA=E7=8E=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将类方法查找中的条件循环改为无限循环以正确处理继承链 - 将类常量查找中的条件循环改为无限循环以正确处理继承链 - 确保在继承链结束时能够正确返回 false 而不是陷入无限循环 --- src/Php/CompilerBase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index 831eb2b4..f0152798 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -1665,7 +1665,7 @@ class CompilerBase extends \PhpAot\Core\Translator $classDef = $this->getClass($class); $methodDef = null; // 递归查找,若子类中未定义方法,则尝试查找父类是否存在此方法 - while ($classDef) { + while (true) { if (!$classDef->hasMethod($method)) { if (!$classDef->extends) { return false; @@ -1711,7 +1711,7 @@ class CompilerBase extends \PhpAot\Core\Translator $classDef = $this->getClass($class); $constDef = null; // 递归查找,若子类中未定义方法,则尝试查找父类是否存在此方法 - while ($classDef) { + while (true) { if (!$classDef->hasConstant($const)) { if (!$classDef->extends) { return false;