ColdFusion structure Bug

26 October 2006 9:44

Found a new bug today in Coldfusion 7. Basically if you create structure via arguments and try to use it later you’ll notice some funky behaviour and the meta information about the structure is incorrect. Code test case is included.

<cfscript>
function struct() { return arguments; } </cfscript>

<cfset s = struct(arg1=“blahblah”, arg2=“cont”, arg3=“act”)>

<cfoutput>
<h3>#s.getClass()#</h3>
length: #structcount(s)# (#structkeylist(s)#)<br>
<cfset structdelete(s, ‘arg1′)>
length: #structcount(s)# (#structkeylist(s)#)<br>
<cfset structdelete(s, ‘arg2′)>
length: #structcount(s)# (#structkeylist(s)#) </cfoutput>

<cfset s = structnew()>
<cfset s['arg1'] = “blahblah”>
<cfset s['arg2'] = “cont”>
<cfset s['arg3'] = “act”>

<cfoutput>
<h3>#s.getClass()#</h3>
length: #structcount(s)# (#structkeylist(s)#)<br>
<cfset structdelete(s, ‘arg1′)>
length: #structcount(s)# (#structkeylist(s)#)<br>
<cfset structdelete(s, ‘arg2′)>
length: #structcount(s)# (#structkeylist(s)#) </cfoutput>

Filed: Technology // Tagged: , ,

You can follow any responses to this entry through the RSS 2.0 feed.

You can leave a comment or leave a trackback from your own site.

Leave a Reply

 
What's ianteresting?   •   Twitter   •   About   •   Contact
©2012 Ian Winter. All Rights Reserved.   •   Powered by WordPress   •   Hosted at Memset