[php-src] Issue #15773: The Not ! opperator in componation with NAN fails with OPcache enabled
| From: | jsiefer | Date: | Fri, 06 Sep 2024 09:30:00 +0000 |
| Subject: | [php-src] Issue #15773: The Not ! opperator in componation with NAN fails with OPcache enabled | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247714@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15773
Author: jsiefer
### Description
The following code:
```php
$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_