Bug #76074 [Opn]: opcache corrupts variable in for-loop
| From: | sjon at hortensius dot net | Date: | Fri, 09 Mar 2018 13:24:24 +0000 |
| Subject: | Bug #76074 [Opn]: opcache corrupts variable in for-loop | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214252@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76074&edit=1
ID: 76074
User updated by: sjon at hortensius dot net
Reported by: sjon at hortensius dot net
Summary: opcache corrupts variable in for-loop
Status: Open
Type: Bug
Package: opcache
Operating System: archlinux
PHP Version: 7.2.3
Block user comment: N
Private report: N
New Comment:
More specifically, opcache.optimization_level=0x000000F0 bugs and
opcache.optimization_level=0x00000000 works
So it's an optimisation issue
Previous Comments:
------------------------------------------------------------------------
[2018-03-09 13:15:37] sjon at hortensius dot net
Description:
------------
A for-loop that uses condition $i < $x + 1 prints very weird numbers.
This requires you to ENABLE the opcache and DISABLE xdebug.
Test script:
---------------
function test(int $nr) {
for ($i = $nr; $i <= $nr + 1; $i++)
var_dump($i);
}
test(1);
Expected result:
----------------
int(1)
int(2)
Actual result:
--------------
int(-9223372036854775808)
int(-9223372036854775808)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76074&edit=1