Open
Description
Description
The following code:
$a = 100.0;
$b = \NAN;
$cmp = $a > $b; // since NAN always false;
$cmp2 = !($a > $b); // $expected true;
var_dump($cmp);
var_dump($cmp2);
assert($cmp === false);
assert($cmp2 === true);
Resulted in this output:
bool(false)
bool(true)
Resulted in this output with opcache enabled:
bool(false)
bool(false) ❌
But I expected this output instead:
bool(false)
bool(true)
The issue only seems to appear using opcache. Also spotted on different environments with older PHP versions.
PHP 8.3.11 (cli) (built: Aug 30 2024 16:21:34) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.11, Copyright (c) Zend Technologies
with Xdebug v3.3.1, Copyright (c) 2002-2023, by Derick Rethans
with Zend OPcache v8.3.11, Copyright (c), by Zend Technologies
PHP Version
PHP 8.3.11
Operating System
No response