#51047 [Opn->Bgs]: keyword "continue": argument type-check would be safer
ID: 51047
Updated by: aharvey@php.net
Reported By: matze73 at hallo dot ms
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: any
PHP Version: 5.2.12
New Comment:
A syntax error is a syntax error, fundamentally, and this is
specifically documented as a case to watch for in the manual. The fact
that continue can take any expression -- whether numeric or not -- has
been the case for a long time and can't be changed without breaking
backward compatibility.
Closing.
Previous Comments:
------------------------------------------------------------------------
[2010-02-14 17:19:28] matze73 at hallo dot ms
Description:
------------
The 'continue' keyword can have a numerical argument which is not
type-checked.
Php could do a type-check on the argument that would catch (some)
syntax errors where the ";" is missing after 'continue'.
Please consider the syntax error of a missing ";" after 'continue'.
The reproduce-code "eats" the following line during runtime.
Reproduce code:
---------------
if ( condition )
continue // missing ; here
$a = "test";
Expected result:
----------------
The line
$a = "test"
is expected to be executed if condition is false.
Actual result:
--------------
The line
$a = "test"
is only executed if 'condition' is true.
No warning during run-time although continue's argument-type is
incorrect.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=51047&edit=1
Thread (2 messages)