Title:
[ANeff] Bug for: break/continue have erroneous behavior outside of loop/case
| View in TrackerStatus/Resolution/Reason: Closed/Won't Fix/
Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)
Created: 08/27/2016
Components: Language
Versions: 2016
Failure Type:
Found In Build/Fixed In Build: CF2016_Update2 /
Priority/Frequency: Minor / Very few users will encounter
Locale/System: English / Win All
Vote Count: 0
break/continue have erroneous behavior outside of loop/case. Verified in CF11 and CF2016.
Repro:
<cfscript>
one = 1;
break;
two = 2;
</cfscript>
<cfscript>
three = 3;
continue;
four = 4;
</cfscript>
<cfscript>
five = 5;
writeDump(var=variables, format="text");
</cfscript>
Actual result:
-----------
struct
FIVE: 5
ONE: 1
THREE: 3
-----------
See? The break/continue statements caused the processing to continue at the next <cfscript> block. That is incorrect behavior, b/c the documentation says: "The break statement exits the current loop or case statement." and "The continue statement ends the current loop iteration, skips any code following it in the loop, and jumps to the beginning of the next loop iteration."
Doc URL: https://helpx.adobe.com/coldfusion/developing-applications/the-cfml-programming-language/extending-coldfusion-pages-with-cfml-scripting/using-cfscript-statements.html
Expected result:
"Context validation error for the break statement." and "Context validation error for the continue statement." exceptions (similar to the exceptions thrown when <cfbreak> and <cfcontinue> are used outside of a <cfloop>)
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 4184638
External Customer Info:
External Company:
External Customer Name: Aaron Neff
External Customer Email:
Attachments:
Comments: