|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76116 Switch can include if()-statment instead of "case" or "default"
Submitted: 2018-03-19 17:20 UTC Modified: 2018-03-19 17:25 UTC
From: rei-ayanami at gmx dot net Assigned:
Status: Not a bug Package: PHP Language Specification
PHP Version: 7.2Git-2018-03-19 (Git) OS: Windows 10
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:
8 + 47 = ?
Subscribe to this entry?

 [2018-03-19 17:20 UTC] rei-ayanami at gmx dot net
By mistake (wrong line) I have set a if() within a switch. Example:

$var = 2;
switch ($var)
	case 1: break;
	if ($var==2)

But that results not in a syntax error. That if() will never execute, so its useless code. Maybe thats not a bug, but it would help to find stupid input errors. Thanks :)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-19 17:25 UTC]
-Status: Open +Status: Not a bug
 [2018-03-19 17:25 UTC]
This is not a bug dead code is not a syntax error. Syntax errors are used when there is an error in the syntax.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Sep 27 16:01:25 2023 UTC