mirror of
https://github.com/php/php-src.git
synced 2025-01-26 13:44:22 +08: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.
20 lines
275 B
PHP
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
|