parent
c10431f697
commit
110ffc7be6
4 changed files with 42 additions and 23 deletions
@ -1,17 +1,35 @@ |
|||||||
--TEST-- |
--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-- |
--FILE-- |
||||||
<?php |
<?php |
||||||
declare(strict_types=1); |
declare(strict_types=1); |
||||||
function Hello(string $value) {} |
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 { |
try { |
||||||
require __DIR__ . '/Hello.php'; |
require includePath('hello'); |
||||||
} catch (ArgumentCountError $e) { |
} catch (ArgumentCountError $e) { |
||||||
echo "ArgumentCountError Error"; |
echo "require ArgumentCountError\n"; |
||||||
} |
} |
||||||
} |
} |
||||||
?> |
?> |
||||||
--EXPECT-- |
--EXPECT-- |
||||||
ArgumentCountError Error |
include ArgumentCountError |
||||||
|
require ArgumentCountError |
||||||
|
|||||||
@ -0,0 +1 @@ |
|||||||
|
report_memleaks=0 |
||||||
Loading…
Reference in new issue