php-src/ext/opcache/tests/ssa_bug_004.phpt
Nikita Popov a171522983 Exception safety for direct CV assign of *CALL instrs
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.
2016-06-18 00:08:38 +02:00

20 lines
275 B
PHP

--TEST--
Assign elision exception safety: ICALL
--FILE--
<?php
set_error_handler(function() { throw new Exception; });
function test() {
$x = str_replace(['foo'], [[]], ['foo']);
}
try {
test();
} catch (Exception $e) {
echo "caught\n";
}
?>
--EXPECT--
caught