tracker issue : CF-4198479

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

isNull throw errors when passed struct key inside array

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/AsDesigned

Reporter/Name(from Bugbase): Bradley Wood / Bradley Wood ()

Created: 04/03/2017

Components: Language

Versions: 2016

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 10, 11, 2016 / 2018,0,0,303846

Priority/Frequency: Normal / Some users will encounter

Locale/System: ALL / Platforms All

Vote Count: 5

Problem Description:

isNull() throws an error when you pass it a non-existent key referenced from a struct inside an array.

Steps to Reproduce:

myArray = [];
 myStruct = \{};
 myArray[ 1 ] = myStruct;
 writeOutput( isNull( myArray[1].value ) );

Actual Result:

This code works as expected on Lucee Server and returns "true". On ACF 10, 11, and 2016, it throws the error "Element VALUE is undefined in a CFML structure referenced as part of an expression."

Expected Result:

Should return the value "true".

Any Workarounds:

Use structKeyExists() or pull out the struct into an intermediate variable.

Attachments:

Comments:

Oops, under expected result, I meant to type "should return the value 'true'". I can't edit my ticket to fix it though :/
Comment by Bradley W.
968 | April 03, 2017 01:43:54 AM GMT
[sigh]
Vote by Adam C.
972 | April 03, 2017 05:36:49 AM GMT
+1 - It should return boolean, not throw exception.
Vote by Aaron N.
973 | April 03, 2017 06:50:54 AM GMT
To add to this (it's sort of implied by Brad, I think) but this works: foo = { bar = {} }; isNull( foo[ "bar" ] ); And this Errors: foo = { bar = {} }; isNull( foo[ "baz" ] );
Comment by Mingo H.
969 | April 03, 2017 08:42:12 AM GMT
Handling NULLs been really frustrating, please fix it.
Vote by sana u.
974 | April 03, 2017 09:13:46 AM GMT
I am not sure if this is part of a different ticket, but here's another weird scenario: foo = { bar = javacast("null",0) }; isNull( foo[ "bar" ] ); // exception is thrown isNull( foo.bar ); // works
Comment by Evagoras C.
970 | April 03, 2017 10:15:54 AM GMT
Evagoras, there is a separate ticket for that (two tickets actually) https://tracker.adobe.com/#/view/CF-3777274 https://tracker.adobe.com/#/view/CF-409839
Comment by Bradley W.
971 | April 03, 2017 02:03:00 PM GMT