tracker issue : CF-3596883

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

SerializeJSON() does not work on closures

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Luis Majano / Luis Majano (Luis Majano)

Created: 07/17/2013

Components: AJAX, Plumbing

Versions: 10.0

Failure Type: Crash

Found In Build/Fixed In Build: Final / 286297

Priority/Frequency: Major / All users will encounter

Locale/System: English / Platforms All

Vote Count: 1

Problem Description:
Try to serializeJSON on a closure and it spins forever with endless loops.
Steps to Reproduce:
var f = function(){
	return "hello";
};
		
writeDump( serializeJSON( f ) );

Actual Result:

Expected Result:
That it would serialize it.

Any Workarounds:
NOT USE JSON

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

Watson Bug ID:	3596883

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

Attachments:

Comments:

See my comment for more discussion... At a minimum, CF shouldn't take minutes to fail. With that part I agree, so this bug should be addressed one way or another. It should either exclude functions or throw an exception (quickly!), or successfully serialize them.
Vote by External U.
14918 | July 18, 2013 08:58:41 AM GMT
Personally I don't think there's much value in serializing a function (closure or otherwise). I could be convinced, though. What's the use case? And what happens when the closure uses CFML that doesn't have an equivalent in JS?
Comment by External U.
14914 | July 18, 2013 08:59:08 AM GMT
Adam it's the situation I mention here: http://cfmlblog.adamcameron.me/2013/07/yeah-so-it-wouldnt-be-my-working-week.html. I'd also already raised another ticket for it: https://bugbase.adobe.com/index.cfm?event=bug&id=CF-3594386 -- Other Adam
Comment by External U.
14915 | July 18, 2013 03:41:58 PM GMT
Bug fixed (Comment added from ex-user id:vnigam)
Comment by Adobe D.
14916 | February 18, 2014 02:01:40 AM GMT
Test case at cfsuite\coldfusion\functions\ajax\serializejson\bugCF-3596883.cfm (Comment added from ex-user id:vnigam)
Comment by Adobe D.
14917 | February 18, 2014 02:01:50 AM GMT