1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/live_range_phi_leak.phpt
Nikita Popov df7417d127 Fix incorrectly optimized out live range
For x ? y : z style structures, the live range starts at z, but
may also hold the value of y. Make sure that the refcounting check
takes this into account, by checking the type of a potential phi
user.
2020-11-17 10:19:57 +01:00

20 lines
336 B
PHP

--TEST--
Missing live range if part of phi
--FILE--
<?php
function doThrow() {
throw new Exception("Test");
}
function test($k) {
// The 0 gives the QM_ASSIGN a non-refcounted type.
$res[$k ? $k : 0] = doThrow();
}
try {
test(new stdClass);
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Test