|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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: Thu May 26 08:03:48 2022 UTC