tracker issue : CF-3594386

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

CF Stack-overflows if one tries to serializeJson() a function

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 07/12/2013

Components: Language

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: 9.0.1 / 286297

Priority/Frequency: Normal / Few users will encounter

Locale/System: English / Win XP All

Vote Count: 0

See: http://cfmlblog.adamcameron.me/2013/07/yeah-so-it-wouldnt-be-my-working-week.html

Repro:

<cfscript>
function f(){
	a = 1;
	b = {};
	c = [];
	d = now();
	e = createUuid();
	writeDump(local);
}

st = {
	f = f
};

s = serializeJson(st);
</cfscript>

Causes stack overflow on CF9; generates nonsense on CF10.

-- 
Adam

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

Watson Bug ID:	3594386

Keywords:
FixTested


External Customer Info:
External Company:  
External Customer Name: Adam Cameron.
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

Why would you try to serialize a CF function in JSON? I don't see any use case and therefore it will be a low priority bug. If you can give us some use case, we can reconsider the priority.
Comment by Rupesh K.
14991 | July 15, 2013 05:50:54 AM GMT
Cheers for the quick feedback, Rupesh. Please bear in mind you need to actually contact the person who raised the issue as well, as this system does not send out notifications. To answer your question: you wouldn't *want to*. But sometimes one doesn't know the contents of the payload one is serialising. A case in point is - which I explained in the blog article I linked to, which might have been good for you to have read - that Mockbox uses serializeJson() for something it does to arguments of mocked methods. And I have a method which I'm mocking which takes a function as an argument. As Mockboxes code caters for [all situations], it falls afoul of this. Details of the mockbox issue here (also linked to from my blog article): https://ortussolutions.atlassian.net/browse/MOCKBOX-10 -- Adam
Comment by External U.
14992 | July 15, 2013 09:54:42 AM GMT