1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 14:31:06 +02:00
Files
archived-php-src/Zend/tests/throw/leaks.phpt
Nikita Popov 19e886d9d8 Avoid throw expression leaks
Mark "throw" used in expression context with a flag, and don't
treat it as a BB terminator in that case. This prevents us from
optimizing away the following opcodes as unreachable, which may
result in live ranges being dropped incorrectly.

Close GH-5450.
2020-04-27 15:22:05 +02:00

32 lines
426 B
PHP

--TEST--
throw expression should not leak temporaries
--FILE--
<?php
try {
new stdClass(throw new Exception);
} catch (Exception $e) {
echo "Caught\n";
}
try {
$a = [];
($a + [1]) + throw new Exception;
} catch (Exception $e) {
echo "Caught\n";
}
try {
@throw new Exception;
} catch (Exception $e) {
echo "Caught\n";
}
var_dump(error_reporting());
?>
--EXPECT--
Caught
Caught
Caught
int(32767)