Title:
cfxml, cfsavecontent inserting extra whitespace when user defined functions used inline
| View in TrackerStatus/Resolution/Reason: Closed/Withdrawn/NotABug
Reporter/Name(from Bugbase): Bryan Henderson / Bryan Henderson (Bryan Henderson)
Created: 02/11/2016
Components: General Server
Versions: 11.0
Failure Type: Incorrect w/Workaround
Found In Build/Fixed In Build: CF11_Final /
Priority/Frequency: Major / All users will encounter
Locale/System: English / Win 2012 Server x64
Vote Count: 0
Problem Description: Extra whitespace is being added at the leading hash tag when a user defined function is used. Note that built in functions do not exhibit this behavior, nor does the use of UDFs outside the cfxml or cfsavecontent tags (other tags that generate/store content between their start and end tags may also be affected)
Steps to Reproduce: Run the following code to see extraneous whitespace added to the attribute values where the UDF is used:
<cffunction name="echo" returntype="string">
<cfargument name="value" required="true" />
<cfreturn arguments.value />
</cffunction>
<cfset myVar = "this" />
<cfset myOtherVar = "snow#echo('flake')#" />
<cfxml variable="test"><cfoutput>
<mytag
attrOne="ok"
attrtwo="#myvar#"
attrthree="#myvar#ok"
attrfour="#echo(myvar)#"
attrfive="dog#echo('house')#"
attrsix="d#'og' & echo('house')#"
attrseven="rain#trim(' bow')#"
attreight="#myOtherVar#"
/></cfoutput>
</cfxml>
<cfdump var="#toString(test)#" /><br>
<cfsavecontent variable="test2"><cfoutput>
<mytag
attrOne="ok"
attrtwo="#myvar#"
attrthree="#myvar#ok"
attrfour="#echo(myvar)#"
attrfive="dog#echo('house')#"
attrsix="d#'og' & echo('house')#"
attrseven="rain#trim(' bow')#"
attreight="#myOtherVar#"
/></cfoutput>
</cfsavecontent>
<cfdump var="#test2#" />
Actual Result: the values for the attributes attrfour, attrfive, and attrsix all have a whitespace char in them located at the position of the first hash tag ment to evaluate the UDF:
<?xml version="1.0" encoding="UTF-8"?>
<mytag attrOne="ok"
attreight="snowflake"
attrfive="dog house"
attrfour=" this"
attrseven="rainbow"
attrsix="d oghouse"
attrthree="thisok"
attrtwo="this" />
Expected Result: The inline rendering of variables should not include any whitespace as none is included in the variables themselves or added by the UDF
<?xml version="1.0" encoding="UTF-8"?>
<mytag attrOne="ok"
attreight="snowflake"
attrfive="doghouse"
attrfour="this"
attrseven="rainbow"
attrsix="doghouse"
attrthree="thisok"
attrtwo="this" />
Any Workarounds: as can be seen in the example "myOtherVar" is generated with the UDF, but does not receive the extra white space because it was generated outside the cfxml tag. This is the only workaround to guarantee white space is not incorrectly added at the leading hash tag
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 4116755
External Customer Info:
External Company:
External Customer Name: Bryan Henderson
External Customer Email:
External Test Config: My Hardware and Environment details:
ColdFusion Server Enterprise 11,0,06,295053
Windows Server 2012 R2 AMD64
Attachments:
Comments: