From c10431f6978d59b3309554c271e30fd84f660f46 Mon Sep 17 00:00:00 2001 From: NathanFreeman <1056159381@qq.com> Date: Sun, 9 Aug 2026 17:10:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91=E5=90=8E?= =?UTF-8?q?=E7=9A=84=E7=A8=8B=E5=BA=8F=E9=80=9A=E8=BF=87=20Zend=20VM=20?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E8=87=AA=E8=BA=AB=E7=9A=84=E5=87=BD=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=AD=A4=E6=97=B6=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E8=BF=87=E5=A4=9A=EF=BC=8C=E4=BC=9A=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E6=AE=B5=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CompilerBase.php | 21 ++++++++++++++++++++- tests/compiler/include_require/001.phpt | 17 +++++++++++++++++ tests/compiler/include_require/Hello.php | 3 +++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 tests/compiler/include_require/001.phpt create mode 100644 tests/compiler/include_require/Hello.php diff --git a/src/CompilerBase.php b/src/CompilerBase.php index f5852a39..beb3484b 100644 --- a/src/CompilerBase.php +++ b/src/CompilerBase.php @@ -3544,7 +3544,26 @@ class CompilerBase implements PropertyAccessContext break; } - return 'php::include(' . $this->parseIdentifier($expr->expr) . ', ' . $type . ')'; + /** + * If an included PHP file encounters a fatal error during execution—for example, + * incorrect function arguments—an exception will be thrown, unwinding directly from + * the Zend VM stack through the C++ stack. In the original implementation, + * there were several "undestroyed temporary objects." When the exception propagates back, + * those objects need to be destroyed. However, by that time the environment + * is already in a corrupted/inconsistent state, and attempting to destroy them causes a crash. + */ + $fileName = $this->parseIdentifier($expr->expr); + return << +--EXPECT-- +ArgumentCountError Error diff --git a/tests/compiler/include_require/Hello.php b/tests/compiler/include_require/Hello.php new file mode 100644 index 00000000..91224ec5 --- /dev/null +++ b/tests/compiler/include_require/Hello.php @@ -0,0 +1,3 @@ +