CF creating spurious variables
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

