#31049 [NEW]: FOR loop = infinite looping
| From: | francois at b-powers dot be | Date: | Fri, 10 Dec 2004 02:16:39 +0000 |
| Subject: | #31049 [NEW]: FOR loop = infinite looping | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-70004@lists.php.net to get a copy of this message | ||
From: francois at b-powers dot be
Operating system: Red Hat Linux release 9 (Shrike)
PHP version: 4.3.9
PHP Bug Type: Unknown/Other Function
Bug description: FOR loop = infinite looping
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 bug report at http://bugs.php.net/?id=31049&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31049&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31049&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31049&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31049&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31049&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31049&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31049&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31049&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31049&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31049&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31049&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31049&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31049&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31049&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31049&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31049&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31049&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31049&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31049&r=mysqlcfg