Bug #80742 [NEW]: Opcache JIT makes some boolean logic unexpectedly be true
| From: | dktapps at pmmp dot io | Date: | Sat, 13 Feb 2021 00:47:35 +0000 |
| Subject: | Bug #80742 [NEW]: Opcache JIT makes some boolean logic unexpectedly be true | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-232122@lists.php.net to get a copy of this message | ||
From: dktapps at pmmp dot io
Operating system: Windows 10
PHP version: 8.0Git-2021-02-13 (Git)
Package: JIT
Bug Type: Bug
Bug description:Opcache JIT makes some boolean logic unexpectedly be true
Description:
------------
JIT breaks some boolean logic involving
and in ways I don't
understand.
It's possible this occurs with other operators, but I stumbled on this
in code in the wild so I haven't tested further.
When running the following using -dopcache.jit=0 (or without opcache),
the script produces the expected result.
Using -dopcache.jit=1205 produces the broken result.
This occurs in a minimal NTS build with only PHP and OPcache using
https://github.com/php/php-src/commit/6ec25f386ff058b5ecda6f11c5f62e934b31f660,
so it's easily reproducible.
Test script:
---------------
<?php
function checkGroundState(float $movY, float $dy) : void{
var_dump($movY != $dy, $movY < 0, ($movY != $dy and $movY < 0));
var_dump("wow!");
}
checkGroundState(0, 0);
Expected result:
----------------
bool(false)
bool(false)
bool(false)
string(4) "wow!"
Actual result:
--------------
bool(false)
bool(false)
bool(true)
string(4) "wow!"
--
Edit bug report at https://bugs.php.net/bug.php?id=80742&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80742&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80742&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80742&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80742&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80742&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80742&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80742&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80742&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80742&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80742&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80742&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80742&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80742&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80742&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80742&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80742&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80742&r=mysqlcfg