php.net |  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
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rei-ayanami at gmx dot net
New email:
PHP Version: OS:

 

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

$var = 2;
switch ($var)
{
	case 1: break;
	if ($var==2)
	{
		die('here');
	}
}

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 :)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-19 17:25 UTC] peehaa@php.net
-Status: Open +Status: Not a bug
 [2018-03-19 17:25 UTC] peehaa@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 23:01:29 2024 UTC