tracker issue : CF-4184638

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] Bug for: break/continue have erroneous behavior outside of loop/case

| View in Tracker

Status/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:

Please change this ticket's "Found In Build" from "CFB2016_Update2" to "CF2016_Update2". It's annoying that Bugbase's default build for new CF2016 tickets is "CFB2016_Update2" :/ Please ask the Bugbase team to add a publicly-visible comment on 4159326. Thanks!, -Aaron
Comment by External U.
1947 | August 27, 2016 11:05:43 AM GMT
@Aaron : Thanks for pointing this out. It's a genuine ask, but it might break backward compatibility as people might be using break/continue statements this way for long. Also, it has got very little impact. So, we are planning not to fix it and let it work the way it has been working.
Comment by Nikhil D.
1948 | September 21, 2016 04:48:54 AM GMT