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

From: Date: Mon, 19 Mar 2018 17:20:54 +0000
Subject: Bug #76116 [NEW]: Switch can include if()-statment instead of "case" or "default"
Groups: php.standards 
Request: Send a blank email to standards-+get-1322@lists.php.net to get a copy of this message
From: rei-ayanami at gmx dot net Operating system: Windows 10 PHP version: 7.2Git-2018-03-19 (Git) Package: PHP Language Specification Bug Type: Bug Bug description:Switch can include if()-statment instead of "case" or "default" 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 bug report at https://bugs.php.net/bug.php?id=76116&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76116&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76116&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76116&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76116&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76116&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76116&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76116&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76116&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76116&r=support Expected behavior: https://bugs.php.net/fix.php?id=76116&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76116&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76116&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76116&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76116&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76116&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76116&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76116&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76116&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76116&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76116&r=mysqlcfg

« previous php.standards (#1322) next »