diff --git a/src/CompilerBase.php b/src/CompilerBase.php index 3529a95d..71d00b51 100644 --- a/src/CompilerBase.php +++ b/src/CompilerBase.php @@ -3510,7 +3510,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 @@ +