|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-04-05 20:18 UTC] 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;
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 19:00:01 2025 UTC |
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