#22225 [Opn->Bgs]: Foreach statement allows for unexpected ';' without throwing error.

From: Date: Fri, 14 Feb 2003 19:22:33 +0000
Subject: #22225 [Opn->Bgs]: Foreach statement allows for unexpected ';' without throwing error.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-33194@lists.php.net to get a copy of this message
ID: 22225 Updated by: moriyoshi@php.net Reported By: ldouglas@whiteiron.tv -Status: Open +Status: Bogus Bug Type: Regexps related Operating System: Redhat 7.1 PHP Version: 4.3.0 New Comment: 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 } Previous Comments: ------------------------------------------------------------------------ [2003-02-14 13:16:30] ldouglas@whiteiron.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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22225&edit=1

« previous php.bugs (#33194) next »