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
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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2019 The PHP Group
All rights reserved.
Last updated: Sat Dec 07 09:01:24 2019 UTC