Title:
[ANeff] Bug for: CanSerialize()/CanDeserialize() not called for XML serialization/deserialization
| View in TrackerStatus/Resolution/Reason: To Fix//BugVerified
Reporter/Name(from Bugbase): Aaron N. / ()
Created: 09/05/2019
Components: Language, Serialization
Versions: 2018
Failure Type: Incorrectly functioning
Found In Build/Fixed In Build: 2018.0.04.314546 /
Priority/Frequency: Normal / Some users will encounter
Locale/System: / Windows 10 64 bit
Vote Count: 0
Issue: CanSerialize()/CanDeserialize() not called for XML serialization/deserialization
Repro:
Application.cfc
-----------
component {THIS.name = "ticket_CustomSerializer";
THIS.secureJSONPrefix="";
THIS.customSerializer = "Serializer";
}
-----------
index.cfm
-----------
<cfscript>
o = new MyCFC();
writeOutput("(de)serializeJSON():");
serialized = serializeJSON(o, false, false, true);
deserialized = deserializeJSON(serialized, true, true);
writeOutput("<br>(de)serializeXML():");
serialized = serializeXML(o, true);
deserialized = deserializeXML(serialized, true);
writeOutput("<br>(de)serialize(json):");
serialized = serialize(o, "json", true);
deserialized = deserialize(serialized, "json", true);
writeOutput("<br>(de)serialize(xml):");
serialized = serialize(o, "xml", true);
deserialized = deserialize(serialized, "xml", true);
</cfscript>
-----------
Serializer.cfc
-----------
component {
public function canSerialize() {
writeOutput("canSerialize() ");
return true;
}
public function canDeserialize() {
writeOutput("canDeserialize() ");
return true;
}
public function serialize() {
writeOutput("serialize() ");
return "from serialize()";
}
public function deserialize() {
writeOutput("deserialize() ");
return "from deserialize()";
}
}
-----------
MyCFC.cfc
-----------
component {}
-----------
Actual Result (on CF11/CF2016/CF2018):
-----------
(de)serializeJSON():canSerialize() serialize() canDeserialize() deserialize()
(de)serializeXML():serialize() deserialize()
(de)serialize(json):canSerialize() serialize() canDeserialize() deserialize()
(de)serialize(xml):serialize() deserialize()
-----------
Expected Result (on CF11/CF2016/CF2018):
-----------
(de)serializeJSON():canSerialize() serialize() canDeserialize() deserialize()
(de)serializeXML():canSerialize() serialize() canDeserialize() deserialize()
(de)serialize(json):canSerialize() serialize() canDeserialize() deserialize()
(de)serialize(xml):canSerialize() serialize() canDeserialize() deserialize()
-----------
Confirmed in CF11 Update 7 (build 11.0.07.296330), CF2016 Update 1 (build 2016.0.01.298513) and CF2018 Update 4 (build 2018.0.04.314546).
So, not a backward-compat issue but should still be fixed.
Attachments:
Comments: