Edit report at https://bugs.php.net/bug.php?id=64594&edit=1
ID: 64594 Updated by: ni...@php.net Reported by: vdeepakkumar at msn dot com Summary: case without default should be failed -Status: Open +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: 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. Previous Comments: ------------------------------------------------------------------------ [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