php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31049 FOR loop = infinite looping
Submitted: 2004-12-10 03:16 UTC Modified: 2004-12-11 11:45 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: francois at b-powers dot be Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.9 OS: Red Hat Linux release 9 (Shrike)
Private report: No CVE-ID: None
 [2004-12-10 03:16 UTC] 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&amp;langue=$langue&amp;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&amp;langue=$langue&amp;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

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-10 07:44 UTC] francois at b-powers dot be
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
 [2004-12-10 11:17 UTC] francois at b-powers dot be
Same kind of issue of this link: http://bugs.php.net/bug.php?id=30307 but here i have Php 4.3.9, how did you fix it ?

Thanks,
Francois
 [2004-12-11 01:09 UTC] francois at b-powers dot be
Hello, 

Finally we find out an issue in our php.ini

[Zend]
zend_optimizer.optimization_level=15
zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-2.5.3
zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-2.5.3
;zend_extension=/usr/local/Zend/lib/ZendExtensionManager.so
zend_extension_ts=/usr/local/Zend/lib/ZendExtensionManager_TS.so

Well it seems to be a bug or bogus, we don't know why that extension (we just uncommented) of Zend would create that kind of endless loops.  

We are just happy that is solved, if it's really bug could you tell us ?

Thanks for your support,
For B-Powers,

Francois
 [2004-12-11 11:45 UTC] derick@php.net
It's not a bug in PHP, so we mark this bug as Bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Aug 17 19:01:28 2024 UTC