I came across this issue during a code review, and thought it might be of note. Specifically, use of cfstoredproc. StatusCode inspired this.
You know that rule about var scoping all variables called in a function unless they are specifically needed elsewhere? Well don’t forget to do it to most of the “ColdFusion tag-specific variables.” They are:
Anything that returns a simple value (string, numeric, Boolean, numeric) or an even arrays and queries can be var scoped at the head of the function with an empty string. (Although for every type but query I like to initialize it with the correct data type.) Structs however have to be initialized with a StructNew().
I omit from the list:
CFcatch only exists during the execution of a cfcatch block and is accessible only by code in that block. In any case, my normal test for variable scope leakage doesn’t detect it, so I’m assuming it’s a special case. If anyone knows different please let me know. Likewise CFerror only exists in page referenced by a cferror tag, which probably couldn’t be in CFC call. (But I could be wrong.)