php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22225 Foreach statement allows for unexpected ';' without throwing error.
Submitted: 2003-02-14 13:16 UTC Modified: 2003-02-14 13:22 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ldouglas at whiteiron dot tv Assigned:
Status: Not a bug Package: Regexps related
PHP Version: 4.3.0 OS: Redhat 7.1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ldouglas at whiteiron dot tv
New email:
PHP Version: OS:

 

 [2003-02-14 13:16 UTC] ldouglas at whiteiron dot tv
foreach($someArray AS $index => $key);
{
   ...instructions
}


Assuming that $someArray has a length greater than 1;  The semi-colon at the end of the foreach() statement does not throw a syntax error and it also does not loop through the instructions, rather it runs the instructions once with what would be the 'last' set of $key

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-14 13:22 UTC] moriyoshi@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Imagine the following case:

if (true); // if statement is terminated by a semicolon.
/* blah */
{
 // this block has nothing to do with the above statement
}

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 11 05:01:27 2024 UTC