php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1483 parser endless loop within "while () / endwhile"
Submitted: 1999-06-01 15:10 UTC Modified: 1999-06-01 15:14 UTC
From: jw at de dot uu dot net Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0.8 OS: any (found @ Solaris)
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: jw at de dot uu dot net
New email:
PHP Version: OS:

 

 [1999-06-01 15:10 UTC] jw at de dot uu dot net
At PHP2 it seemed to be very popular to use "while (expr); ... endwhile;".
Also the usage of "while (expr): ... endwhile;" produced an error:
    parse error, expecting `END_TAG' or `';'' or `'{'' on line 8
(Note the different delimiters ';' and ':' after "while ()"

With PHP3 the syntax changed to use ":" as the delimiter 
or (more likely) the users coded C syntax: "while (expr) { ... }".
Put the parser misses to detect a falsely used ';' which
causes an endless loop: (at least with PHP 3.0.7 and 3.0.8)

<?
        $num=3; $i=0;
        while ($i<$num);
                Echo "$i, "; 
                $i++;
        endwhile;
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-06-01 15:14 UTC] jim at cvs dot php dot net
This isn't a bug. The syntax of while loops changed to:
  while() statement
and it is valid for statement to be empty.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 07:01:29 2024 UTC