One of the things that I frequently see ColdFusion developers forgetting about or getting wrong is the output attribute on cffunction.
Either it’s completely omitted, in which case it’s the same as adding output=true (and will result in extra whitespace being output).
Or it’s incorrectly set to true. I think developers sometimes assume that if they’re doing something like looping over a query using <cfoutput query=”…”> then they need to have the output set to true.
Here’s a couple of handy regular expressions I sometimes use to find when this has happened. This blog article is more for my own future reference than anything else.
First (this is from Brian Ghidinelli), this one finds functions without the output attribute:
Secondly, this finds those where it’s not set as false or no.
The (?! … ) syntax is a negative lookahead. Basically we’re saying, get me everywhere we have something that looks like cffunction output = (not ‘false’ or ‘no’)
This is assuming your text editor can do negative lookaheads. Alternatively it’s probably simpler to do that the other way round and get everywhere it is cffunction output = (‘true’ or ‘yes’)