#31049 [Opn]: FOR loop = infinite looping
| From: | francois at b-powers dot be | Date: | Fri, 10 Dec 2004 06:44:30 +0000 |
| Subject: | #31049 [Opn]: FOR loop = infinite looping | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-70007@lists.php.net to get a copy of this message | ||
ID: 31049
User updated by: francois at b-powers dot be
Reported By: francois at b-powers dot be
Status: Open
Bug Type: Unknown/Other Function
Operating System: Red Hat Linux release 9 (Shrike)
PHP Version: 4.3.9
New Comment:
One strange thing that i learned by testing if, i put $link++; instead
if $link=$link+1; it's working why ?
Or even if i put $i<= (12+0), is it a string problem ?
By the way my FOR loops are working in a small test.php page but in my
big php page (47kb) public.php
Thanks,
Francois
Previous Comments:
------------------------------------------------------------------------
[2004-12-10 03:16:10] francois at b-powers dot be
Description:
------------
Hello,
I have a user who just moved to my server and the script was working
fine on Php 4.3.9 loaded as a CGI. Now, we are on Apache with php
loaded as a module. Here is our phpinfo:
http://www.b-powers.be/phpinfo.php
The problem is about FOR loops. Indeed, for some reasons, it's going to
an endless looping even if the code is right.
Hoping someone will be able to help us,
We tried to fix it since 3 days.
Francois
Ps; this script is made of a lot of files using FOR loops so we are
looking for a fix in this memory problem or bug, so we won't need to
edit all files. THANKS A LOT.
Reproduce code:
---------------
<select name="month" id="month" style="BACKGROUND-COLOR: <?php echo
$body_fond['valeur']; ?>;"
onChange="MM_jumpMenu('parent',this,0)">
<?
for ($i = 1; $i <= 12; $i++) {
$link = $i+1;
IF($_GET['month'] == $link){
$selected = "selected";
} ELSE {
$selected = "";
}
echo "<option
value=\"public.php?espace=$_GET[espace]&testi=$i&month=$link&langue=$langue&year=$_GET[year]\"
$selected>" . traduc($langue,date ("F",
mktime(0,0,0,$i,1,$_GET['year']))) . "</option>\n";
}
/* IF I DO REPLACE IT WITH A WHILE IT WILL WORK ...
$i=1;
while ($i <= 12)
{
$link = $i+1;
IF($_GET['month'] == $link)
$selected = "selected";
} ELSE {
$selected = "";
}
echo "<option
value=\"public.php?espace=$_GET[espace]&month=$link&langue=$langue&year=$_GET[year]\"
$selected>" . traduc($langue,date ("F",
mktime(0,0,0,$i,1,$_GET['year']))) . "</option>\n";
$i++;
}
*/
?>
</select>
Expected result:
----------------
showing in a scrollbox, the 12 months
Actual result:
--------------
endless loop
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31049&edit=1