|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51047 keyword "continue": argument type-check would be safer
Submitted: 2010-02-14 17:19 UTC Modified: 2010-02-15 02:55 UTC
From: matze73 at hallo dot ms Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.12 OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: matze73 at hallo dot ms
New email:
PHP Version: OS:


 [2010-02-14 17:19 UTC] matze73 at hallo dot ms
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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-15 02:55 UTC]
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.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Jan 23 13:03:35 2022 UTC