Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is output=false needed for all cfc method written in CFML?

Is output="false" needed for all cfc method written in CFML? or it'd be okay as long as the outer most caller function has output="false"?

What if we don't add output="false" on any CFC methods, but we make sure the top-most caller is inside a <cfsilent> block? is that okay?

Is output="false" solely for suppressing whitespace? I recall years ago CFer's said having output="false" helps with preventing memory leak: myth or fact?

like image 433
Henry Avatar asked Oct 04 '22 22:10

Henry


1 Answers

Unfortunately, in Adobe ColdFusion, output="false" at the component level does not affect each individual function, just the constructor area. This may not even matter because I can't think of a way to output anything from the constructor, and indeed, even changing to output="true" seems to make no difference.

I have now (thanks to you, Henry) experimented with chaining functions with output="false", and your suspicions are right - a calling function with output="false" will suppress the output from any function it calls. This was in Adobe ColdFusion 9.0.1.

Adding a cfsilent around the initialization of a component will mute output from the component without an output="false", but again I don't think that does anything. Putting around a function call will mute any output from anything it calls.

output="false" is solely for whitespace suppression. You could argue that adding whitespace to the output buffer would increase memory usage, per request, but I wouldn't really call it a leak - perhaps if you have tens of thousands of component/function calls, it could cause trouble.

Output="true" does have a different effect, treating a function as if it has <cfoutput> tags wrapped around it, and evaluating any # dynamic things automatically.

like image 178
Nathan Strutz Avatar answered Oct 18 '22 23:10

Nathan Strutz