Title:
SerializeJSON turns strings that look like scientific notation into floats.
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Chris Phillips / Chris Phillips (cf_chris)
Created: 01/17/2014
Versions: 10.0
Failure Type: Data Corruption
Found In Build/Fixed In Build: Final, 287843 / CF10_Update14
Priority/Frequency: Critical / Some users will encounter
Locale/System: English / Windows 7 64-bit
Vote Count: 1
Problem Description:
SerializeJSON turns strings that look like scientific notation into floats.
In our case those strings happen to be Stock Numbers. Changing them to floats is breaking our application.
Furthermore, I would be surprised if anyone that is using CF would find this a desired behavior. If someone WERE passing around a "string" that WAS in scientific notation, I DO NOT think the would want it CHANGED when serialized to JSON.
Steps to Reproduce:
<cfoutput>
<cfset str = "1234E-1" />
<p>#SerializeJSON({str: str})#</p><!--- No space --->
<p>#SerializeJSON({str: str & " "})#</p><!--- Space at the end --->
<p>#SerializeJSON({str: " " & str})#</p><!--- Space at the beginning--->
</cfoutput>
Actual Result:
{"STR":123.4} // WRONG
{"STR":123.4} // WRONG
{"STR":" 1234E-1"} // CORRECT (But, I don't want spaces BEFORE my string.)
Expected Result:
{"STR":"1234E-1"} // No space
{"STR":"1234E-1 "} // Space at the end
{"STR":" 7373E-1"} // Space at the beginning
Any Workarounds:
Only ones that are too awful to mention.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3695627
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: