php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23534 cannot use echo or print more than 13 times in a script
Submitted: 2003-05-07 16:23 UTC Modified: 2003-06-26 18:20 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mark at onelauter dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4.3.2RC3-dev OS: Windows 2000 Server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mark at onelauter dot com
New email:
PHP Version: OS:

 

 [2003-05-07 16:23 UTC] mark at onelauter dot com
This works.

  for ($i=0; $i < 13; $i++)
  {
    echo "$i ";
  }

This gets stuck in an infinate loop.

  for ($i=0; $i < 14; $i++)
  {
    echo "$i ";
  }

Any value of 14 or greater results in the same problem.

It also occurs with while loops.

This works.

  $i = 0;
  while ($i < 13)
  {
    echo "$i ";
    $i++;
  }

This gets stuck in an infinate loop.

  $i = 0;
  while ($i < 14)
  {
    echo "$i ";
    $i++;
  }

The same problem will occur if I do this.

  $i = 0;
  while ($i < 13)
  {
    echo "$i ";
    $i++;
  }
  for ($i=0; $i < 13; $i++)
  {
    echo "$i ";
  }

Even though the loops would work indepedently, they won't work in the same php file.

I'm running as an ISAPI process with IIS 5 (inetinfo.exe version # 5.0.2195.3649).  If I run the same test script on the command line with php.exe I don't have a problem.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-07 23:37 UTC] mark at onelauter dot com
Thank you for the fast reply,

I tried the snapshot located here:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

I still have the same problem.  I tried an older version too (4.2.x) and it also couldn't count higher than 13.

I could prearrange to have this server open live to the internet for a short period so that someone could check my test script with php info if that would help.
 [2003-05-07 23:41 UTC] mark at onelauter dot com
I should mention that these scripts are currently running fine on an older windows 2000 server.  Since I want to retire this box I basically copied the existing installation to the new machine and adjusted NTFS permissions, set up IIS to use the ISAPI version and everything worked fine (as far as i can tell) except for this looping issue.
 [2003-05-08 00:22 UTC] mark at onelauter dot com
One new important development.  I just figured out that its not the while loop or for loop that are generating the problem.

This works.

  while ($i < 50)
  {
    $i++;
  }
  echo "$i ";

However, if I put 14 echo statements in the file it fails.  In other words, this works.

  echo "1";
  echo "2";
  ... lots of echos ...
  echo "13";

But if I add one more echo to the file it goes off into never never land.
 [2003-05-08 00:51 UTC] mark at onelauter dot com
I found the same issue with "print" as I did with "echo".
 [2003-05-08 01:08 UTC] mark at onelauter dot com
I don't know if it will help, but this sample also doesn't work.

<?php
  for ($i=0;$i < 15;$i++)
  {
?>
test
<?    
  }
?>

There seems to be an issue with the output buffer.  FWIW, I have buffering turned off to avoid the performance hit.
 [2003-05-08 03:26 UTC] edink@php.net
This is something wrong with your local configuration. The exact same setup is running on many installs without the described problem. I suggest you try re-installing php with default php.ini first, and then if it doesn't help re-installing the whole machine.
 [2003-05-08 11:31 UTC] mark at onelauter dot com
I suspect that you're correct.  I can run scripts from the command line with no problems so I think it has something to do with the ISAPI setup.  I've checked build numbers on the 2 web servers and they're the same, it runs on one but not the other.

I'll just wipe the box and start over.  If it fixes it I'll let you know.

Cheers.  :)
 [2003-05-12 23:34 UTC] mark at onelauter dot com
I totally wiped the server (reformatted the HD) and reinstalled everything.

I still encounter the same problem.

However, from the localhost everything works as expected.  There are no errors in any of the php scripts.  I only encounter the problem when trying to access the scripts from another machine.  I had lots of trouble getting file permissions set and wonder if this could still be an issue, although I'm not getting any permission errors.  Scripts also run fine from the local command line.
 [2003-05-12 23:35 UTC] mark at onelauter dot com
just updated summary, see previous post for additional details...
 [2003-05-13 00:22 UTC] mark at onelauter dot com
sigh... I *finally* got it to work.

I changed output_buffering from 0 to 4096 and it started working.  I have no idea why that make a difference.
 [2003-05-13 20:07 UTC] sniper@php.net
Could you try this with Apache 1.3.27 ? (so that we know if it's IIS specific.)


 [2003-05-13 23:04 UTC] mark at onelauter dot com
Sure, I'll be happy to try it with Apache.  It'll be a few days before I can make time.  BTW, I did verify that the problem occured with both cgi (php.exe) and isapi on IIS.  If it works in Apache but not IIS, I'll forward all the information I can about my setup.
 [2003-06-14 13:26 UTC] jharrell at dlc4me dot com
Just noticed that 4.3.2 Final does not echo correctly to the cli. It pauses for several seconds... then when the script is nearly done it slams me with 4 pages of text... 4.2.3 Final works just fine. (I tried the 4.3.2 because an issue w/ fdf was nearly fixed... but it would seem that 4.3.2 has more problems than I am willing to battle with) jh
 [2003-06-26 18:20 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 17:01:28 2024 UTC