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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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: Mon Oct 14 06:01:27 2024 UTC