|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80742 Opcache JIT makes some boolean logic unexpectedly be true
Submitted: 2021-02-13 00:47 UTC Modified: 2021-02-16 11:10 UTC
Avg. Score:5.0 ± 0.0
Reproduced:5 of 5 (100.0%)
Same Version:5 (100.0%)
Same OS:5 (100.0%)
From: dktapps at pmmp dot io Assigned: dmitry (profile)
Status: Closed Package: JIT
PHP Version: 8.0Git-2021-02-13 (Git) OS: Windows 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: dktapps at pmmp dot io
New email:
PHP Version: OS:


 [2021-02-13 00:47 UTC] dktapps at pmmp dot io
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, so it's easily reproducible.

Test script:

function checkGroundState(float $movY, float $dy) : void{
	var_dump($movY != $dy, $movY < 0, ($movY != $dy and $movY < 0));

checkGroundState(0, 0);

Expected result:
string(4) "wow!"

Actual result:
string(4) "wow!"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-16 11:10 UTC]
-Status: Open +Status: Verified -Assigned To: +Assigned To: dmitry
 [2021-02-16 17:02 UTC]
Automatic comment on behalf of
Log: Fixed bug #80742 (Opcache JIT makes some boolean logic unexpectedly be true)
 [2021-02-16 17:02 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 08 10:01:28 2023 UTC