|  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
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: rei-ayanami at gmx dot net
New email:
PHP Version: OS:


 [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: Fri Sep 22 23:01:24 2023 UTC