Yesterday someone emailed me asking about the assignCategory method of BlogCFC. Specifically, they wanted to know why I did this:

<cfset var checkEC = "">

Where checkEC was defined as a query a few lines later. They noticed I did this throughout my code and were not sure why. I explained to them about how scoping works in UDFs. Any variable created in a UDF will automatically "leak" out of the UDF. (Note, when I say UDF, I also mean CFC method, as this applies to both.) This is easy enough to fix by using the VAR scope within your function.

However, you shouldn't forget that some tags act just like cfset. So for example, my cfquery tag creates a variable as well. By var scoping the name of the query, I ensure that the data doesn't escape the method.

So for most readers, this is old news, but it certainly can't hurt to repeat - as forgetting to var scope can lead to serious issues down the road.