|  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
49 + 36 = ?
Subscribe to this entry?

 [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: Sat May 21 03:05:45 2022 UTC