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
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:
MUST BE VALID
Solve the problem:
31 + 32 = ?
Subscribe to this entry?

 
 [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: Fri Apr 26 18:01:31 2024 UTC