tracker issue : CF-3695697

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

SerializeJSON will NOT wrap certain string formats with quotes.

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Chris Phillips / Chris Phillips (cf_chris)

Created: 01/17/2014

Components: AJAX, Plumbing

Versions: 10.0

Failure Type: Data Corruption

Found In Build/Fixed In Build: Final / CF10_Update14

Priority/Frequency: Critical / Some users will encounter

Locale/System: English / Windows 7 SP1 64-bit

Vote Count: 0

Problem Description:
I think it's any string that conforms to the following pattern: ([0-9]+D ) << Notice the space at the end.

Steps to Reproduce:
<cfoutput>
	<p>#SerializeJSON({s:"1A "})#</p>
	<p>#SerializeJSON({s:"1D"})#</p>
	<p>#SerializeJSON({s:"12D "})#</p>
	<p>#SerializeJSON({s:"34D "})#</p>
	<cfset str = "56D " />
	<p>#SerializeJSON({s:str.toString()})#</p>
</cfoutput>

Actual Result:
{"S":"1A "} // Fine
{"S":"1D"}  // Fine
{"S":12D }  // Wrong (will cause JS error)
{"S":34D }  // Wrong (will cause JS error)
{"S":56D }  // Wrong (will cause JS error)


Expected Result:
{"S":"1A "}
{"S":"1D"}
{"S":"12D "}
{"S":"34D "}
{"S":"56D "}


Any Workarounds:
Trim the values. 
However, some may actually want the full string. And having something that innocent create invalid JSON is stupid.

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

Watson Bug ID:	3695697

Deployment Phase:	Release Candidate

External Customer Info:
External Company:  
External Customer Name: cf_chris
External Customer Email:  
External Test Config: My Hardware and Environment details:

Windows 7 (SP1) 64-bit

ColdFusion 10 - 10,0,12,286680

Java Version - 1.7.0_17

Attachments:

Comments:

It seems to be related to how floats and doubles are defined as literals in Java: https://en.wikipedia.org/wiki/Java_syntax#Literals -- Adam
Comment by External U.
13653 | January 17, 2014 04:05:41 PM GMT
This issue is fixed in the next major version.
Comment by Nimit S.
13654 | January 18, 2014 02:57:23 AM GMT
Nimit, does this mean it will be in the next updater to CF 10? Or does it mean it's fixed in CF 11?
Comment by External U.
13655 | January 21, 2014 11:42:17 AM GMT