Edit report at https://bugs.php.net/bug.php?id=64594&edit=1
ID: 64594 Updated by: ras...@php.net Reported by: vdeepakkumar at msn dot com Summary: case without default should be failed Status: Not a bug Type: Feature/Change Request Package: *Compile Issues Operating System: ALL PHP Version: 5.4.13 Block user comment: N Private report: N New Comment: Maybe, but C-derived languages do not and there is tons of code out there that specifically relies on this feature. I have written a bunch myself. This will never change. Previous Comments: ------------------------------------------------------------------------ [2013-04-05 21:05:01] vdeepakkumar at msn dot com Actually C# compiler checks such anomalies. Control cannot fall through from one case label ('case <title>:') to another. Check out an example http://stackoverflow.com/questions/6696692/control-cannot- fall-through-from-one-case-label ------------------------------------------------------------------------ [2013-04-05 20:52:32] ni...@php.net No way this is going to happen. PHP's switch allows fall-through and intentionally so. Same way it works in nearly any other language implementing switch. ------------------------------------------------------------------------ [2013-04-05 20:18:38] vdeepakkumar at msn dot com Description: ------------ When we have switch case statements and when case statements are skipped of break statement inadvertantly the page/control would fail. Similar to C#, php compiler should throw an error 'Control can not fall through case constructs'. Test script: --------------- switch ($t) { case "t": echo "test"; case "e": echo "e test"; } Expected result: ---------------- It should fail with parse error and the user correction should be switch ($t) { case "t": echo "test"; break; case "e": echo "e test"; break; } Actual result: -------------- It should fail with parse error and the user correction should be switch ($t) { case "t": echo "test"; break; case "e": echo "e test"; break; } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=64594&edit=1