tracker issue : CF-3694950

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

Unexpected writeOutput() and <cfoutput> difference

| View in Tracker

Status/Resolution/Reason: Closed/Won't Fix/TooManySideEffects

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 01/16/2014

Components: Language

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: Final /

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Linux All

Vote Count: 1

See:
http://cfmlblog.adamcameron.me/2014/01/unexpected-writeoutput-and-difference.html

Bottom line: CFOUTPUT has special powers that make it differe from writeOutput() and OUTPUT=TRUE which it's documented to not have.

All three should behave the same in the situation documented in my article.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3694950

External Customer Info:
External Company:  
External Customer Name: Adam Cameron.
External Customer Email:  
External Test Config: Repro:

<!--- testOutput.cfm --->

<cffunction name="usingCfoutput">

	TEXT WITHIN usingCfoutput():<br>

	<cfoutput>#generateContent()#</cfoutput>

</cffunction>



<cffunction name="usingWriteOutput">

	TEXT WITHIN usingWriteOutput():<br>

	<cfscript>writeOutput(generateContent());</cfscript>

</cffunction>



<cffunction name="usingOutputTrue" output="true">

	TEXT WITHIN usingWriteOutput():<br>

	<cfscript>writeOutput(generateContent());</cfscript>

</cffunction>



<cffunction name="generateContent">

	<cfset var s = "">

		BEFORE CFOUTPUT<br>

		<cfoutput>IN OUTPUT<br></cfoutput>

		AFTER CFOUTPUT<br>

	<cfreturn s>

</cffunction>



<cfsetting enablecfoutputonly="true">



<cfoutput>Calling usingCfoutput():<br></cfoutput>

<cfset usingCfoutput()>



<cfoutput><hr></cfoutput>



<cfoutput>Calling usingWriteOutput():<br></cfoutput>

<cfset usingWriteOutput()>

<cfoutput><hr></cfoutput>



<cfoutput>Calling usingOutputTrue():<br></cfoutput>

<cfset usingOutputTrue()>

Attachments:

Comments:

+1. I can imagine where this made sense (maybe?) in separation between how script and tags are parsed in their own manners, but let's think about consistency of effect here. Both applications of outputting content should react the same with there job (which should be the same?). Especially when you can mix code formats as Adam has to shown in his example.
Vote by External U.
13683 | January 16, 2014 07:41:42 PM GMT
Writeoutput is behaving perfectly fine as the "generateContent" function would behave if called directly. While the <cfoutput> tag does seem to behave differently changing it may cause a serious backward compatibility issue.
Comment by Awdhesh K.
13682 | November 20, 2014 01:24:13 AM GMT