1--TEST-- 2Bug #74431 - foreach infinite loop 3--INI-- 4opcache.enable=1 5opcache.enable_cli=1 6opcache.optimization_level=0x7fffffff 7--EXTENSIONS-- 8opcache 9--FILE-- 10<?php 11function test(){ 12 $arr = [1,2]; 13 $j = 0; 14 $cond = true; 15 foreach ($arr as $i => $v){ 16 while(1){ 17 if($cond){ 18 break; 19 } 20 } 21 $j++; 22 echo $j."\n"; 23 if ($j>10) break; 24 } 25} 26test(); 27?> 28--EXPECT-- 291 302 31