Bug #76074 [Opn->Ver]: opcache corrupts variable in for-loop

From: Date: Sat, 10 Mar 2018 00:44:39 +0000
Subject: Bug #76074 [Opn->Ver]: opcache corrupts variable in for-loop
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214258@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 Updated by: jhdxr@php.net Reported by: sjon at hortensius dot net Summary: opcache corrupts variable in for-loop -Status: Open +Status: Verified Type: Bug Package: opcache Operating System: archlinux PHP Version: 7.2.3 Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2018-03-09 13:24:22] sjon at hortensius dot net More specifically, opcache.optimization_level=0x000000F0 bugs and opcache.optimization_level=0x00000000 works So it's an optimisation issue ------------------------------------------------------------------------ [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

« previous php.bugs (#214258) next »