修复编译后的程序通过 Zend VM 调用自身的函数,如果此时临时变量过多,会导致段错误的问题 #47
Merged
韩天峰
merged 2 commits from fix/include_require_file into master 2 weeks ago
4 changed files with 42 additions and 1 deletions
@ -0,0 +1,35 @@ |
||||
--TEST-- |
||||
include/require unwind safely when ZendVM calls a compiled function that throws |
||||
--ENV-- |
||||
PHPRC=tests/compiler/include_require/no-leak.ini |
||||
--FILE-- |
||||
<?php |
||||
declare(strict_types=1); |
||||
function Hello(string $value) {} |
||||
|
||||
function includePath(string $name): string |
||||
{ |
||||
return implode('', [__DIR__, '/', ucfirst(strtolower($name)), '.php']); |
||||
} |
||||
|
||||
function main(): void |
||||
{ |
||||
// Keep this name: generated helper variables must not collide with PHP locals. |
||||
$filename = includePath('hello'); |
||||
|
||||
try { |
||||
include $filename; |
||||
} catch (ArgumentCountError $e) { |
||||
echo "include ArgumentCountError\n"; |
||||
} |
||||
|
||||
try { |
||||
require includePath('hello'); |
||||
} catch (ArgumentCountError $e) { |
||||
echo "require ArgumentCountError\n"; |
||||
} |
||||
} |
||||
?> |
||||
--EXPECT-- |
||||
include ArgumentCountError |
||||
require ArgumentCountError |
||||
@ -0,0 +1,3 @@ |
||||
<?php |
||||
declare(strict_types=1); |
||||
Hello(); |
||||
@ -0,0 +1 @@ |
||||
report_memleaks=0 |
||||
Loading…
Reference in new issue