Bug #76074 [Ana->Csd]: opcache corrupts variable in for-loop

From: Date: Sat, 10 Mar 2018 14:20:57 +0000
Subject: Bug #76074 [Ana->Csd]: opcache corrupts variable in for-loop
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214267@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: bwoebi@php.net Reported by: sjon at hortensius dot net Summary: opcache corrupts variable in for-loop -Status: Analyzed +Status: Closed Type: Bug Package: opcache Operating System: archlinux PHP Version: 7.2.3 Assigned To: jhdxr Block user comment: N Private report: N New Comment: Automatic comment on behalf of bobwei9@hotmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=9c6df8a238c4492704d9f37d2a155cf85d704804 Log: Fix bug #76074 (opcache corrupts variable in for-loop) Previous Comments: ------------------------------------------------------------------------ [2018-03-10 08:23:34] jhdxr@php.net it seems we missed some overflow & underflow check when we do inferncing. https://github.com/php/php-src/blob/master/ext/opcache/Optimizer/zend_inference.c#L905 I'm working on it. ------------------------------------------------------------------------ [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 (#214267) next »