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
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: 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: Sat Dec 21 12:01:31 2024 UTC