tracker issue : CF-4206419

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

serializeJSON fails silently

| View in Tracker

Status/Resolution/Reason: To Fix//

Reporter/Name(from Bugbase): Ben F. / ()

Created: 12/18/2019

Components: Language, Serialization

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: adobe 2018.0.07+316715 /

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Windows 10 64 bit

Vote Count: 2

I have a component name TestVO with three properties.
1. keyOne (numeric)
2. keyTwo (numeric)
3. oneDividedByTwo (numeric)

For the 3rd property I wrote a custom getter, which divides value of keyOne by the value of keyTwo, and disabled the setter
Let's say I instantiate the object with keyOne=10 and keyTwo=0. I know this will result in division by zero.
Then put the instantiated object in an array,
var aArray = [oTest];
and put the array in a struct.
var stStruct = {"anArray": aArray};

Then try to get the JSON representation of the structure with serializeJSON...
serializeJSON(stStruct)

serializeJSON will NOT fail, but give an invalid json string!! This is not expected!
{"anArray":[}

I expected this to fail, and not generate invalid JSON

If you try to serialize only the array,
serializeJSON(aArray)
an expected error is thrown (Division by zero error)

I have attached a test project so you can use that to verify the error.

Attachments:

Comments:

It is bad enough that ColdFusion processes this inadequately. But {"anArray":[} as a JSON result? Come on, CF!
Vote by A. B.
32023 | December 18, 2019 02:26:45 PM GMT