mirror of
https://github.com/php/php-src.git
synced 2024-09-29 05:46:06 +00:00
a171522983
Converting T = *CALL; ASSIGN $v, T into $v = *CALL may not be safe if an exception is thrown after the return value has been populated -- in this case the value might be destroyed twice.
25 lines
319 B
PHP
25 lines
319 B
PHP
--TEST--
|
|
Assign elision exception safety: UCALL
|
|
--FILE--
|
|
<?php
|
|
|
|
function test() {
|
|
$dtor = new class { function __destruct() { throw new Exception; } };
|
|
$a = 1;
|
|
return [0, $a];
|
|
}
|
|
|
|
function test2() {
|
|
$x = test();
|
|
}
|
|
|
|
try {
|
|
test2();
|
|
} catch (Exception $e) {
|
|
echo "caught\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
caught
|