Bug #74431 [Opn->Csd]: foreach infinite loop

From: Date: Fri, 14 Apr 2017 20:04:49 +0000
Subject: Bug #74431 [Opn->Csd]: foreach infinite loop
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208569@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74431&edit=1 ID: 74431 Updated by: nikic@php.net Reported by: onceatease at gmail dot com Summary: foreach infinite loop -Status: Open +Status: Closed Type: Bug Package: opcache Operating System: Ubuntu 12.04.5 LTS PHP Version: 7.1.2 Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=3ffe2cd251731d68493becf8ebbe6312ee86bb8d Log: Fixed bug #74431 Previous Comments: ------------------------------------------------------------------------ [2017-04-14 15:01:30] ekin at coproductivity dot com I was able to reproduce that it causes an infinite loop when in a function on versions above 7.1.0. Also it's not just php-fpm, can also see it behaves the same on cli. Opened a PR with failing test https://github.com/php/php-src/pull/2479 ------------------------------------------------------------------------ [2017-04-14 14:27:30] pollita@php.net Disabling the opcacge optimizer makes this go away, so it's probably in the break/cont optimization. ------------------------------------------------------------------------ [2017-04-14 07:36:40] onceatease at gmail dot com The code should be included in the function function test(){ $arr = [1,2]; $j = 0; $cond = true; foreach ($arr as $i => $v){ while(1){ if($cond){ break; } } $j++; echo $j."<br>"; //if($j>100) break; } } test(); ------------------------------------------------------------------------ [2017-04-13 20:30:20] ekin at coproductivity dot com I cannot reproduce this with php-fpm on any of 7.1.2, 7.1.3 or 7.1.4 on Ubuntu 16.04 LTS, having opcache enabled. Which related opcache settings did you use? ------------------------------------------------------------------------ [2017-04-13 10:07:47] onceatease at gmail dot com exec correctly in php7.1.0 test without php7.1.3 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=74431 -- Edit this bug report at https://bugs.php.net/bug.php?id=74431&edit=1

« previous php.bugs (#208569) next »