Hello,
I've encountered this problem that is while in a function and 'var'
the complex data type, it will be passed by reference in a way.
(tested with array and struct)
Example of this:
<cffunction name="testArray">
<cfset var aCategory = ArrayNew(1)>
<cfset ArrayAppend(aCategory,"testabc")>
<cfset var aCategoryTest = aCategory>
<cfloop from="1" to="#ArrayLen(aCategory)#" index="i">
<cfif aCategory[i] eq "testabc">
<cfset deletePos = i>
</cfif>
</cfloop>
<cfset ArrayDeleteAt(aCategory,deletePos)>
<cfdump var="#aCategory#">
<cfdump var="#aCategoryTest#">
</cffunction>
<cfset testArray()>
The above example will dump both variables as empty array, which is
not suppose to be the case as <cfset var aCategoryTest = aCategory> is
a deep copy and shouldn't be modified when aCategory is changed. I've
tested this on BD.net which treats both as different copies.
A temporary solution is to use <cfset var aCategoryTest =
Duplicate(aCategory)>
Please let me know if there is a fix for this.
Thanks
WW
--
official tag/function reference: http://openbd.org/manual/
mailing list - http://groups.google.com/group/openbd?hl=en