Bug #76116 [Opn->Nab]: Switch can include if()-statment instead of "case" or "default"

[email protected] Mon, 19 Mar 2018 17:25:41 GMT
Newsgroups php.standards
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=76116&edit=1

 ID:                 76116
 Updated by:         [email protected]
 Reported by:        rei-ayanami at gmx dot net
 Summary:            Switch can include if()-statment instead of "case"
                     or "default"
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            PHP Language Specification
 Operating System:   Windows 10
 PHP Version:        7.2Git-2018-03-19 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

This is not a bug dead code is not a syntax error. Syntax errors are used when there is an error in the syntax.


Previous Comments:
------------------------------------------------------------------------
[2018-03-19 17:20:52] 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 :)



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=76116&edit=1