php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #677 Infinite looping of for when include used in body of for
Submitted: 1998-08-21 08:57 UTC Modified: 1998-08-21 09:03 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: xkosj06 at vse dot cz Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 3.0.3 OS: Win NT 4.0 Workstation
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: xkosj06 at vse dot cz
New email:
PHP Version: OS:

 

 [1998-08-21 08:57 UTC] xkosj06 at vse dot cz
I have written script, which should include somefile.txt 
for example ten times:

for($i=0;$i<10;$i++)
    include "somefile.txt";

When I have ran this script, I have obtained 10 warnings,
stating that PHP can not include somefile.txt. After that,
PHP starts including somefile.txt in infinite loop.

I have tryed same code using alternate for syntax:

for($i=0;$i<10;$i++):
    include "somefile.txt";
endfor;

And everything worked well. Everything worked also if I 
rewrite this piece of code to use while loop.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-08-21 09:03 UTC] zeev
include(), require(), eval() and basically any statement
that executes other code isn't considered as a single
statement, but as a statement list.  Therefore, they cannot
reside inside non-encapsulated loops.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 05 06:01:36 2025 UTC