Skip to main content
Inspiring
February 26, 2011
Answered

CF creating spurious variables

  • February 26, 2011
  • 2 replies
  • 2676 views

G'day

I hope the forums are in a good mood today, and will allow me to paste code in here.  Let's see...

Could I ask y'all a favour?  Could you pls run this code on CF9, and let me know the results:

<cfif structKeyExists(URL, "bung") AND URL.bung>
    <cfset st = {
        foo = "bar"
    }>
<cfelse>
    <cfset st = structNew()>
    <cfset st.foo = "bar">
</cfif>
<cfloop item="sKey" collection="#variables#">
    VARIABLES.<cfoutput>#sKey#</cfoutput> found.  Value:<br />
    <cfdump var="#variables[sKey]#" label="#sKey#">
    <hr />
</cfloop>
<cfdump var="#variables#" label="variables">

(contrast the results when passing ?bung=true and ?bung=false on the URL.

We are seeing CF creating a spurious variable "___IMPLICITARRYSTRUCTVAR0" being created in the variables scope, when using {} notation for creating structs.

This does not happen on CF8, but does happen on CF9 (9.0, 9.0.1, 9.0.1+CHF).

It only happens when the code is in a CFM file; not a CFC file.

It's "interesting" that Adobe are suppressing the output of this variable in CFDUMP.

--

Adam

    This topic has been closed for replies.
    Correct answer BKBK

    Now with query-string ?bung=true

    2 replies

    BKBK
    Community Expert
    BKBKCommunity ExpertCorrect answer
    Community Expert
    February 26, 2011

    Now with query-string ?bung=true

    Inspiring
    February 26, 2011

    Thanks.  That's what we're seeing too.  I know of one person who is not seeing this though.  Weird.

    --

    Adam

    Inspiring
    February 26, 2011

    I've created a bug report:

    http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#bugId=86496

    --

    Adam

    BKBK
    Community Expert
    Community Expert
    February 26, 2011

    This is the result without query-string or when the query-string is ?bung=false.

    My ColdFusion build: 9.0.1.274733.

    Message was edited by: BKBK