tracker issue : CF-3912073

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

When we define a variable using cfsavecontent it adds a newline to the variable along with the content.

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): / ext-user (Suchika Singh)

Created: 12/18/2014

Components: Language, Tags

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: 11.0.03.292643 /

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Win XP All

Vote Count: 1

Problem:When we define a variable using cfsavecontent it adds a newline to the variable along with the content.

Method:Use the following code:
<cfsavecontent variable="myDDX">
<?xml version="1.0" encoding="UTF-8"?>
<DDX xmlns="http://ns.adobe.com/DDX/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ns.adobe.com/DDX/1.0/ coldfusion_ddx.xsd">
<PDF result="pdfOut">
<PageSize width="2in" height="2in" scaleUp="true" />
<PDF source="pdfIn" />
</PDF>
</DDX>
</cfsavecontent>
<cfdump var="#myDDX#">
 <cfset fileWrite(expandPath('./myDDX.ddx'), #myDDX#) />


Result:Check the file 'myDDX.ddx' it has a one line space as a result ISDDX for the variable is failing.

Expected:No space should be added

Workaround:

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

Watson Bug ID:	3912073

External Customer Info:
External Company:  
External Customer Name:  
External Customer Email:

Attachments:

Comments:

+1 - Thanks, Suchika, for filing this!
Vote by External U.
9250 | December 26, 2014 05:49:30 PM GMT
To clarify: it adds 2 newlines cfsavecontent adds a newline before -and- after the content. cfxml correctly does not add a newline before or after the content. Thanks!, -Aaron
Comment by External U.
9244 | December 26, 2014 05:53:07 PM GMT
This is not a bug. There is 9 line breaks in your <cfsavecontent> block (which starts immediately after the > of <cfsavecontent> with a line break, and there's another one immediately before </cfsavecontent>), and these are all present in the result. The problem is the code: if you don't wan extraneous line breaks before the <?xml?> declaration or after the </DDX>, *don't put them in*! CF is doing exactly what you're asking it to do here.
Comment by External U.
9245 | December 27, 2014 04:19:52 AM GMT
Hi Suchika and Adam, Adam makes a good point (basically, I shouldn't have had the line breaks in the repro case I was working on for #CF-3870997 =P). I was just trying to help, and messed-up there. I believe the fix for #CF-3912078 will sufficiently resolve the issues I mentioned in the following comments on #CF-3870997: 7:51:43 AM GMT+00:00 Dec 12, 2014 3:36:00 PM GMT+00:00 Dec 26, 2014 Basically, once isDDX() trims its input before validation, there should not be any issue (<cfpdf action="processddx"> processes the DDX fine, but isDDX() currently returns false). Thanks!, -Aaron
Comment by External U.
9246 | January 06, 2015 05:47:22 AM GMT
Suchika, can you sum up the action item after verifying the missing feature.
Comment by Awdhesh K.
9247 | August 18, 2015 12:41:13 AM GMT
Hi all, Please see #CF-4056840. Thanks!, -Aaron
Comment by External U.
9248 | September 15, 2015 03:18:21 PM GMT
Hi, A linebreak after <cfsavecontent> creates a one line space.This can be resolved if we define the ddx variable as follows: <cfsavecontent variable="myDDX"><?xml version="1.0" encoding="UTF-8"?> <DDX xmlns="http://ns.adobe.com/DDX/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ns.adobe.com/DDX/1.0/ coldfusion_ddx.xsd"> <PDF result="pdfOut"> <PageSize width="2in" height="2in" scaleUp="true" /> <PDF source="pdfIn" /> </PDF> </DDX></cfsavecontent> Hence closing the bug. We have the bug open for ISDDX to trim the DDX variable before validating the DDX as open. (CF-3912078). This bug would be fixed to keep ISDDX() consistent with <cfpdf action="processddx" ..>. Thanks, Suchika.
Comment by Suchika S.
9249 | September 21, 2015 02:08:05 AM GMT