tracker issue : CF-3912078

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

ISDDX does not trim the variable before validating.

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

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

Created: 12/18/2014

Components: Document Management, PDF manipulation

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: 0

Problem:ISDDX does not trim the variable before validating.

Method:Run 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>
 <cfset fileWrite(expandPath('./myDDX.ddx'), #myDDX#) />
<cfoutput>#isDDX("myDDX.ddx")#</cfoutput> // outputs as invalid because of the space.
<cfoutput>#isDDX("#trim(myDDX)#")#</cfoutput> //outputs as valid because we have trim the space
<cfoutput>#isDDX("#myDDX#")#</cfoutput> // outputs as invalid because of the space.

Result: Outputs a valid DDX as invalid

Expected:Should trim the variable and then validate.

Workaround: Use trim()

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

Watson Bug ID:	3912078

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

Attachments:

Comments:

Hi Suchika, When you test the fix for this ticket, could you also please test that the following returns the expected result? <cfxml 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> </cfxml> <cfset fileWrite(expandPath('./myDDX.ddx'), myDDX)> <cfdump var="#isXML(variables.myDDX)# #isDDX(variables.myDDX)# #isDDX("myDDX.ddx")#"> Actual result: YES NO YES Expected result: YES YES YES Thanks!, -Aaron
Comment by External U.
9239 | January 06, 2015 05:34:23 AM GMT
No it bloody should not! Stop messing with the values ppl are validating. Just test that the data *as provided* is valid or not. The function is isDdx(), not isDdxIfItWasTrimmed(). Not a bug. And I don't think Suchika should be raising bugs if this is their way of understanding how a programming language is meant to work.
Comment by External U.
9240 | January 06, 2015 02:20:39 PM GMT
To paraphrase: "My kingdom for a downvote button!" This should never have been implemented. I wholeheartedly agree with Adam on this one. How many IsXXX() functions have been completely screwed up trying to "hand-hold" lazy coders? If a valid type of data does not allow leading/trailing whitespace, then a function that validates said data type should always return false if the submitted value contains leading/trailing space. How hard is that to grasp? Imagine the implications: a coder uses IsDDX() to validate an otherwise valid piece of DDX XML that has leading/trailing whitespace. The IsDDX() function returns true, meaning ColdFusion is saying that DDX snippet is valid. Then the coder passes that same DDX snippet to a service or function that operates on that DDX and expects it to be "pure" or valid DDX. What do you expect would happen? It will most likely throw an error! But the coder says: "But ColdFusion said it was valid!!! Arghhhh!!!". Now they will likely spend wasted time filing a new bug report here saying "IsDDX() fails to validate valid DDX".
Comment by External U.
9241 | January 06, 2015 03:20:20 PM GMT
Hi all, Please see #CF-4056840. Thanks!, -Aaron
Comment by External U.
9242 | September 15, 2015 03:17:55 PM GMT