tracker issue : CF-3955565

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

Case not preserved for structs populated inline

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): Darien Brown / Darien Brown (Darien Brown)

Created: 03/18/2015

Components: Language, Serialization

Versions: 11.0

Failure Type: Incorrect w/Workaround

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / All users will encounter

Locale/System: ALL / Core

Vote Count: 0

Problem Description: When a struct is created inline in cfscript, the serialization.preserveCaseForStructKey has no effect. All keys will serialize in upper case.

Steps to Reproduce: Create a struct in cfscript like this:

x = { MyCamelKey="Test string", yetAnotherKey="Another string", mixedCaseBool=true };

Make sure this.serialization.preserveCaseForStructKey is set to true in Application.cfc.

Use SerializeJSON(x) and verify the output. The keys will appear in upper case.

This pattern is used a lot to create a struct populated with default values.

Actual Result: Serialized struct contains all upper case keys.

Expected Result: Keys should be in their original case from when the struct was declared.

Any Workarounds:

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

Watson Bug ID:	3955565

External Customer Info:
External Company:  
External Customer Name: Darien
External Customer Email:  
External Test Config: My Hardware and Environment details: Windows Server 2012, IIS 8.5, ColdFusion 11, x64.



Workaround: Declare empty struct and define keys individually.
Comment by External U.
8020 | March 18, 2015 01:37:35 PM GMT
Hi Darien, It is working for me. Have you tried editing CFM template after changing the value of "this.serialization.preserveCaseForStructKey" property? If not, please try that. As of now, this property is being evaluated only at compile time. There is another bug #CF-3818776 logged where we will enforce this property to be evaluated at runtime as well.
Comment by Nimit S.
8021 | April 14, 2015 06:08:28 AM GMT
As you can read in my initial description of this, "this.serialization.preserveCaseForStructKey" was set to true.
Comment by External U.
8022 | April 14, 2015 08:03:46 AM GMT
I see now. Confirmed working after getting the CFC to compile again.
Comment by External U.
8023 | April 14, 2015 08:08:16 AM GMT
Great. Should I need to close this case now?
Comment by Nimit S.
8024 | April 14, 2015 08:22:39 AM GMT
The first time I encountered this, changes were made to the CFC that would have resulted in a recompile and yet I still had the issue. Now, I am unable to duplicate the problem. Go ahead and close it.
Comment by External U.
8025 | April 14, 2015 08:57:38 AM GMT
Thanks for your confirmation.
Comment by Nimit S.
8026 | April 14, 2015 09:04:38 AM GMT