tracker issue : CF-4199641

select a category, or use search below
(searches all categories and all time range)

Metadata from functions never report default "output" setting

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): Bradley Wood / Bradley Wood ()

Created: 09/11/2017

Components: Language

Versions: 2016

Failure Type: Data Loss

Found In Build/Fixed In Build: 2016 / NA

Priority/Frequency: Normal /

Locale/System: / Platforms All

Vote Count: 1

Problem Description:
It is imperative for frameworks such as MockBox to be able to tell via the metadata of a UDF if that UDF had output set to "true" so it can correctly mock methods.  When you call getMetaData() on a UDF, ColdFusion does not return an "output" key in the metadata unless it was explicitly defined in the code.  This is bad since tag UDFs default to output=true and script UDFs default to output=false.  There's no way to tell from the metadata if a particular UDF was defined in tags or script so there's no way to know what the correct default output value is.  getMetaData needs to correctly return the proper default output key in all cases based on how that function will behave when called without needing to know how it was defined.  This is currently causing issues with the Mockbox framework when it tries to mock a tag-based UDF that needs to return output.

Steps to Reproduce:

<cffunction name="tagUDF"></cffunction>
function scriptUDF() {}

writedump( getMetaData( tagUDF ) );
writedump( getMetaData( scriptUDF ) );

Actual Result:

No output key exists in the metadata.

Expected Result:

The metadata needs to correctly represent which function will allow output.

Any Workarounds:




Upon further review of this ticket, it's come to my attention that the default "output" setting for a script function is actually "true". The difference is simply that tag based functions "leak" whitespace automatically whereas script functions don't output anything unless you are explicit with writeOutput(). I think my workaround for MockBox is that when we stub out replacement methods, we need to always do them in script since stubbing tag based UDFs will leak whitespace. We can either close this ticket, or modify its purpose to have the default output values always appear in the metadata, whether or not they were specified by the user. Either way, the description as I wrote it is a little off and I can't edit it now :/
Comment by Bradley W.
338 | September 13, 2017 02:19:11 PM GMT