Interesting CFDUMP Bug

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>

</cfcomponent> </code>

test2.cfc <cfcomponent>

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

<!— <cffunction name=”test” returnType=”string”> <cfreturn “from test2”> </cffunction> —>

</cfcomponent> </code>

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#”> </code>

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 developer advocate. He focuses on JavaScript, serverless 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 https://www.raymondcamden.com

Comments