[coldbox:6504] renderData as JSON and null values

Hi Luis,

Forgive me but I can’t find how to submit a bug on Assembla. When I click “report issue” on the dashboard tab it indicates that I’m not permitted. Do you have a “bugs” email address?

Thanks.

Nolan

Ok, what I have done and will be updating and announcing. Is that the public can submit anything they want here:
https://github.com/coldbox/coldbox-platform/issues

This will be our teams triage section for bugs, enhancements, etc. Once they are approved (by me :)) then I will move them or a team member will move them to the official tracker so it can be developed on. This will be easier for the general public to submit anything they like to us in a mroe official manner.

Thoughts?

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Hi Luis,

This is great! Thanks! I have added the XML null conversion bug to github. Will github notify us when issues we log have been completed?

Cheers.

Nolan

This may be a silly question, but why doesn’t the JSON plugin simply use the built-in SerializeJSON function when available? I understand it won’t be there in some engines (like ACF 7), but isn’t that what CFMLEngine.isJSONSupported is for?

Thanks

~Brad

Ok, what I have done and will be updating and announcing. Is that the public can submit anything they want here:

Wow, you really are a glutton for punishment-- the E-mail list isn’t bad enough? :slight_smile:

~Brad

Well it has bee there since cf7 but 3.0 is the last cf7 version. So for 3.1 json plugin will disappear for native functions.

I love lists and organization. Lol.
What a geek I am

I picked up a little issue with array serialisation (coldbox rc2 from
git):

line 298 (JSON.cfc)
<cfset loc.data = _data.get(i-1)>

Railo (3.2rc) complains that index i=0 is out of bounds.
Changing this line to the one below makes it happy.
<cfset loc.data = _data[i]>

ACF operates differently (array.get is zero based) whereas Railo
appears to be 1-based

If anyone cares to try it out, the following snippet will output "1"
under ACF and "2" under Railo

<cfset foo = [1,2,3]>
<cfoutput>#foo.get(1)#</cfoutput>

Is there a reason why Array.get() was used in the first place rather
than just using the bracket notation? If so, it may be necessary to
check server version here.

Hmm did you check if bracket notation works on acf?

I checked under CF8 and it works fine.

<cfset foo = [1,2,3]>
<cfoutput>
REFLECTION: #foo.get(1)# <br/>
BRACKET: #foo[1]#
</cfoutput>

the bracket notation above returns consistent result on both Railo and
ACF.

I actually posted the issue on the Railo list and the answer there
was
a) it's a fundamental difference between the two engines that won't be
addressed now or in the future (since it would break arrays)
b) using reflection like that (.get()) is actually slower than
straight bracket notation

Actually I am getting errors when doing bracket notation for null values.

That is why I used the native java get because it retrieves null, if you do array[i] with a null value, cf throws exception.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

found a better solutions: isDefined(array[i])

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

oopps, that didn’t work, ok, I used cfparam for it and will use arrayIsDefined() on 3.1 once cf7 support is dropped.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

it might not be pretty, but a try/catch would sort it out safely

<cftry>
  <cfset loc.data = _data[i]>
  <cfcatch><!--- do nothing ----></cfcatch>
</cftry>

fixed on git!

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com