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
 [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

Pull Requests

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: Thu Dec 26 22:01:28 2024 UTC