So, this was a big thread today on cfcdev that I thought I would share:

If you define a variable as a local scoped variable in a method, and then use the cfinclude tag, any variable that was VAR scoped will be copied over to the Variables scope for the CFC.

So, an example:


   <cffunction name="foo">
      <Cfset var hello ="I am hello">
      <cfdump var="#variables#">
      <cfinclude template="include.cfm">
      <cfreturn"foo was called">
   <cffunction name="get">
      <cfdump var="#variables#">


foo = createObject("component","alpha");;

Note that it doesn't matter what is in include.cfm.

When you run the code, you will notice that the hello variable gets copied over to the global Variable scope in the CFC. (Thanks to Nathan Dintenfass for the nice and simple example.)

As you can guess, this can lead to some very subtle, hard to detect bugs.