tracker issue : CF-4101845

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

[ANeff] Bug for: input containing XML object breaks cfwddx

| View in Tracker

Status/Resolution/Reason: Needs Review//

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)

Created: 12/19/2015

Components: Serialization, WDDX

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Platforms All

Vote Count: 0

input containing XML object breaks cfwddx

Repro:

<cfxml variable="myXML"><myXML>foo</myXML></cfxml>
<cfset myVar = {lastName="no", myQuery=queryNew("myColumn", "integer", [[1]]), myXML=myXML}>
<cfwddx action="cfml2wddx" input="#myVar#" output="myWDDX">
<cfdump var="#myWDDX#">

Actual result: exception "Object Type coldfusion.xml.XmlNodeList is not supported for this operation. Pass object as String."

Expected result: WDDX variable containing XML

Workaround 1: Change myXML=myXML to myXML=toString(myXML) as per the "Pass object as String" message in the exception. However, this is not realistic for already-existing code having complex nested structures w/ values being set throughout multiple locations.
Workaround 2: Use serializeJSON(). However, this is not a valid workaround for existing systems that use WDDX due to stuff like: 1) serializeJSON() loses query column types. Custom serializers are not a valid workaround for that when dealing w/ various complex nested structures. 2) It changes string "no" to boolean false.

Verified in CF11 Update 7 (build 11,0,07,296330).

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

Watson Bug ID:	4101845

External Customer Info:
External Company:  
External Customer Name: Aaron Neff
External Customer Email:

Attachments:

Comments:

cfwddx should toString() all XML Simple as that. The exception isn't useful. Thanks!, -Aaron
Comment by External U.
5024 | July 12, 2016 06:12:35 PM GMT
Hi Adobe, I'm glad to see this is "Needs Review". Each time cfml2wddx touches an XML var, it should toString() it. That resolves the issue. Currently, cfml2wddx throws an exception on XML vars. That isn't useful for already-existing code having complex nested structures w/ values being set throughout multiple locations, including queries (which serializeJSON() can't yet handle properly b/c it loses the query column type info). Thanks!, -Aaron
Comment by Aaron N.
5025 | May 01, 2017 06:48:41 AM GMT
Hi Adobe, Why is this still "Needs Review"? You're explicitly throwing an exception that says pass the XML as string. Ex: When serializing a nested struct, that contains an XML key somewhere, we get this unhelpful error message. Rather than us walking the struct and looking for XML vars and toString'ing them, can you please just replace that error msg w/ a call to toString()? There's no backward-compat issue, since currently an exception is thrown. Thanks!, -Aaron
Comment by Aaron N.
5026 | October 04, 2017 06:31:46 AM GMT
hmm
Comment by Aaron N.
5027 | February 05, 2018 07:02:58 AM GMT
.toString() or not .toString(), that is the question =P
Comment by Aaron N.
5028 | February 05, 2018 07:05:07 AM GMT