Posted in ColdFusion | Posted on 11-04-2009 | 2,451 views
I thought I was going crazy for a minute but I've discovered an interesting bug with CFDUMP under ColdFusion9. Create two components, like so:
test.cfc
2
3<cffunction name="test" returnType="array">
4 <cfreturn [1,2,3]>
5</cffunction>
6
7<cffunction name="getTime" access="remote" returnType="any">
8 <cfreturn now()>
9</cffunction>
10
11</cfcomponent>
test2.cfc
2
3<cffunction name="secondtest" returnType="array">
4 <cfreturn [1,2,3]>
5</cffunction>
6
7<!---
8<cffunction name="test" returnType="string">
9 <cfreturn "from test2">
10</cffunction>
11--->
12
13</cfcomponent>
Notice that both CFCs have different methods. (I'll explain why test is commented out in a second.) Now put both CFCs in an structure (arrays also demonstrate this bug):
2<cfset bucket.test = createObject("component", "test")>
3<cfset bucket.test2 = createObject("component", "test2")>
4
5<cfdump var="#bucket#">
The result is interesting - look at what is in test2 dump:

Yep - the methods from test.cfc "leaked" into the second one. If you use an array you see the same results. If you dump each component by itself, however, you do not see a problem. Also - if you uncomment the test method in the second component, the display for that particular method is correct. In other words, it shows the string return type of string, not array.
I've filed a bug report for this so hopefully it will get corrected in the next update.


@Kyle: Yep, this is a known issue. Either the engineers misunderstood you or ... or something else - but I know Sean (or I believe Sean) Corfield has mentioned this in the past.
@Nathan: It is - or it was back when I worked at Macromedia. :)
This had been driving me crazy today! I thought all my functions were , for some reason, being duplicated into the other objects, making the process pointless. Annoying thing is I Read this blog entry and forgot about it :( It wasn't until a colleague pointed it out that the two instances clicked together!
Anyway thanks for confirming the problem
TJ
[Add Comment] [Subscribe to Comments]