tracker issue : CF-3223465

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

LOCAL scope variable undefined inside object literal in function call

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Stu Gray / Stu Gray (Stubotnik)

Created: 06/26/2012

Components: Language

Versions: 9.0.1

Failure Type: Non Functioning

Found In Build/Fixed In Build: 9.0.1 /

Priority/Frequency: Critical / All users will encounter

Locale/System: English / Windows 7

Vote Count: 0

Problem Description:
LOCAL scope variables are undefined when used inside an object literal which is declared in a function argument list. But only when used inside a loop.

Steps to Reproduce:

<cffunction name="f">
  <cfoutput>
    <cfset LOCAL.foo = 123 />       
    <cfloop from=1 to=1 index="i">  
      #serializeJSON({blah = LOCAL.foo})#
    </cfloop>
  </cfoutput>
</cffunction>

<cfset f() />

Actual Result:

Error: Element FOO is undefined in LOCAL

Expected Result:

No error.

Any Workarounds:

Replace loop above with this:

<cfloop from=1 to=1 index="i">
  <cfset bar = {blah = LOCAL.foo} />
  #serializeJSON(bar)#
</cfloop>

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3223465

External Customer Info:
External Company:  
External Customer Name: Stubotnik
External Customer Email:  
External Test Config: My Hardware and Environment details:



Server Product	 ColdFusion

Version	 9,0,1,274733  

Edition	 Enterprise  

Operating System	 Windows 7  

OS Version	 6.1  

Update Level	 /C:/ColdFusion9/lib/updates/hf901-00004.jar  

Adobe Driver Version	 4.0 (Build 0005)  

JVM Details

Java Version	 1.6.0_17

Attachments:

Comments:

Some discussion here: http://stackoverflow.com/questions/11190518/coldfusion-local-scope-inside-object-literal
Comment by External U.
18851 | June 26, 2012 02:10:06 AM GMT
This bug is verified and found fixed in CF10 Update 11 and CF11, closing the bug (Comment added from ex-user id:nawani)
Comment by Adobe D.
18852 | September 18, 2013 01:40:24 AM GMT