|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-04-13 10:02 UTC] onceatease at gmail dot com
Description:
------------
foreach will infinite loop in php-fpm, in the case while condition is literal and if conditon is a variable(in both php7.1.2 and php7.1.4)
Test script:
---------------
$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;
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 00:00:02 2025 UTC |
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();