Interesting CFDUMP Bug

This post is more than 2 years old.

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 <cfcomponent output="false" >

<cffunction name="test" returnType="array"> <cfreturn [1,2,3]> </cffunction>

<cffunction name="getTime" access="remote" returnType="any"> <cfreturn now()> </cffunction>


test2.cfc <cfcomponent>

<cffunction name="secondtest" returnType="array"> <cfreturn [1,2,3]> </cffunction>

<!--- <cffunction name="test" returnType="string"> <cfreturn "from test2"> </cffunction> --->


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):

<cfset bucket = {}> <cfset bucket.test = createObject("component", "test")> <cfset bucket.test2 = createObject("component", "test2")>

<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.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by Dan Roberts posted on 11/4/2009 at 9:20 PM

Ouch. I assume you've found this to be a problem with cfdump output and not the actual usage of the cfcs?

Comment 2 by Raymond Camden posted on 11/4/2009 at 9:25 PM

Correct. If you try to run the method, you get the standard error.

Comment 3 by salvatore fusto posted on 11/4/2009 at 10:49 PM

Hi Ray, are you sure this is not a problem of structure, or array, assignment? in other word, a memory problem of such type of data?

Comment 4 by Kyle posted on 11/4/2009 at 11:17 PM

Interesting Ray. Have you ever seen what happens in a shared hosting environment when you dump the application scope and your application doesn't have a name? It seems to not be able to find which one to dump, so it dumps all application scopes currently running on the server. Kinda scary if you store dsn's with usernames and passwords in the app scope. The CF architects at MAX this year said this may be a bug but were unaware of it.

Comment 5 by Nathan Mische posted on 11/4/2009 at 11:20 PM

If the tags under WEB-INF/cftags were not pre-compiled we could fix this ourselves. (I'm pretty sure cfdump is implemented in CFML.)

Comment 6 by Raymond Camden posted on 11/5/2009 at 1:01 AM

@sal: It is purely a display issue - nothing more. Following up the 'bad' dump with a good dump shows the CFC as it should be.

@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. :)

Comment 7 by Tom Jenkins posted on 11/9/2009 at 4:43 PM

Hi Ray

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