parent
c10431f697
commit
84559dab09
4 changed files with 26 additions and 24 deletions
@ -1,17 +1,35 @@ |
||||
--TEST-- |
||||
The compiled program calls its own functions via the Zend VM. |
||||
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 main() { |
||||
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 __DIR__ . '/Hello.php'; |
||||
require includePath('hello'); |
||||
} catch (ArgumentCountError $e) { |
||||
echo "ArgumentCountError Error"; |
||||
echo "require ArgumentCountError\n"; |
||||
} |
||||
} |
||||
?> |
||||
--EXPECT-- |
||||
ArgumentCountError Error |
||||
include ArgumentCountError |
||||
require ArgumentCountError |
||||
|
||||
@ -1,3 +1,3 @@ |
||||
<?php |
||||
declare(strict_types=1); |
||||
Hello(); |
||||
Hello(); |
||||
|
||||
@ -0,0 +1 @@ |
||||
report_memleaks=0 |
||||
Loading…
Reference in new issue