mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
If an exception _and_ a warning (or deprecation) is emitted, then the result is destroyed twice. Use an `else if` to prevent this. This is tested via zend_test because the deprecation that triggered the original reproducer may disappear in the future. Closes GH-19793.
28 lines
413 B
PHP
28 lines
413 B
PHP
--TEST--
|
|
GH-19792 (SCCP causes UAF for return value if both warning and exception are triggered)
|
|
--EXTENSIONS--
|
|
opcache
|
|
zend_test
|
|
--INI--
|
|
opcache.enable=1
|
|
opcache.enable_cli=1
|
|
opcache.optimization_level=-1
|
|
--FILE--
|
|
<?php
|
|
|
|
function foo()
|
|
{
|
|
return \zend_test_gh19792();
|
|
}
|
|
|
|
try {
|
|
foo();
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Warning: a warning in %s on line %d
|
|
an exception
|