php-src/Zend/tests/const_eval_and.phpt
Nikita Popov 249e49092d Fix constant evaluation of && and ||
The "return" in the for loop should have been a break on the switch,
otherwise the result is just ignored... but because it prevents
evaluation of the other operand, it also violates the invariant that
everything has been constant evaluated, resulting in an assertion
failure.

The for loop isn't correct in any case though, because it's not legal
to determine the result based on just the second operand, as the
first one may have a side-effect that cannot be optimized away.
2019-12-06 11:07:57 +01:00

10 lines
151 B
PHP

--TEST--
Incorrect constant evaluation of and/or (OSS-Fuzz #19255)
--FILE--
<?php
const C = 0 && __namespace__;
var_dump(C);
?>
--EXPECT--
bool(false)