tracker issue : CF-4198982

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

JSON serializing cfcatch struct changes the stacktrace and loses tagcontext

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Bradley Wood / Bradley Wood ()

Created: 07/04/2017

Components: Language

Versions: 2016,11.0,2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2016 U4 / CF14

Priority/Frequency: Normal / Most users will encounter

Locale/System: / Platforms All

Vote Count: 1

Problem Description:

When you serialize a cfcatch struct, the JSON doesn't match the same data format at all.
stackTrace switches from a string to an array
tagContext disappears completely

Steps to Reproduce:

try {
 sdfrsd();
} catch( any e ){
 writeDump( e );
  writeDump( deserializeJSON( serializeJSON( e ) ) );
} 
https://trycf.com/gist/6ad9f809ebd4e692dd81947309570d6c/acf2016?theme=monokai

Run that code on trycf.com and you can see that the two dumps differ significantly.  This makes it a pain to deal with ColdFusion errors that have been serialized into JSON.  It is an unexpected behavior, and also doesn't match Lucee Server, which correctly serializes the cfcatch struct to match the exact same data.

Actual Result:

stackTrace switches from a string to an array
tagContext disappears completely

Expected Result:

stackTrace is represented the same
tagContext does not disappear

Any Workarounds:

Do some sort of custom serialization.

Attachments:

Comments: