Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)
Created: 04/27/2014
Components: REST Services
Versions: 11.0
Failure Type:
Found In Build/Fixed In Build: PublicBeta /
Priority/Frequency: Major / Some users will encounter
Locale/System: English / Platforms All
Vote Count: 2
Long version:
http://cfmlblog.adamcameron.me/2014/04/coldfusion-11-custom-serialisers-more.html
TL;DR:
when trying to serialise an object, the canSerialize() function receives the argument value "XML" as its first argument. This makes no sense.
Repro:
Application.cfc:
component {
this.name = "serialiser01";
this.customSerializer="Serialiser";
}
Serialiser.cfc:
// Serialiser.cfc
component {
public function canSerialize(){
logArgs(args=arguments, from=getFunctionCalledName());
return true;
}
public function canDeserialize(){
logArgs(args=arguments, from=getFunctionCalledName());
return true;
}
public function serialize(){
logArgs(args=arguments, from=getFunctionCalledName());
return "SERIALISED";
}
public function deserialize(){
logArgs(args=arguments, from=getFunctionCalledName());
return "DESERIALISED";
}
private function logArgs(required struct args, required string from){
var dumpFile = getDirectoryFromPath(getCurrentTemplatePath()) & "dump_#from#.html";
if (fileExists(dumpFile)){
fileDelete(dumpFile);
}
writeDump(var=args, label=from, output=dumpFile, format="html");
}
}
test.cfm:
o = new Basic();
serialised = serializeJson(o);
writeDump([serialised]);
deserialised = deserializeJson(serialised);
writeDump([deserialised]);
Basic.cfc
component {}
canSerialize() should receive the object type or something actually useful.
--
Adam
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3750730
External Customer Info:
External Company:
External Customer Name: Adam Cameron.
External Customer Email:
External Test Config: My Hardware and Environment details:
Attachments:
Comments: