Today I found an interesting script using StructCopy with a URL scope.
I am not looking for answers to the question of how to get around this - I know / used structAppend / duplicate etc.
I wanted to copy the URL scope into a new structure so that I could process / modify it without affecting the URL scope itself, so I used structCopy( url ). I know that structcopy is a shallow copy of the structure, but since my url area will contain only url parameters (as far as I know, is this right?), Anyway, I'm interested in this case), which are string keys / values, I decided that a shallow copy will be adequate (the string is unchanged and thatβs it).
However, when copying the URL region, this led to strange behavior - it seems that it structCopy(url)simply returns the url region, not its copy, and not an error. For example, if I do the following (suppose I have url request parameters, including one called "rob":
<cfset local.clonedUrl = structCopy( url ) />
<cfdump var="#local.clonedUrl#">
<cfdump var="#url#">
<cfset structDelete( local.clonedUrl, "rob" ) />
<cfdump var="#local.clonedUrl#">
<cfdump var="#url#">
In the above scenario, after the delete structure was called, clonedUrl and the URL were both deleted (it is obvious that doing the above with the normal Struct created, not the URL, behaves correctly in the first place)
So my questions are:
? , URL- URLScope , -, structCopy . , , , , , , . , structCopy, , , .
URLScope - Struct? , , URLScope, , Struct. - - , , API/Javadocs?
CF10 ( , - / structAppend/duplicate ..)