tracker issue : CF-4202734

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

[ANeff] Bug for: nested struct reference returns undefined/null from closure

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Aaron Neff / ()

Created: 06/06/2018

Components: Language, Closures

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2018.0.01.308605 (PreRelease) / CF2018U5

Priority/Frequency: Normal / Few users will encounter

Locale/System: / Windows 10 64 bit

Vote Count: 3

Issue: nested struct reference returns undefined/null from closure

Workaround: array notation

Repro:

{code:java}
<cfscript>
  function f1() {
  	var one = {two = {three = "four"}};
  	return one.two.three;
  }
  writeDump(f1());//returns "four" (good)
</cfscript>
{code}


Actual and Expected Result: "four"

{code:java}
<cfscript>
  function f2() {
  	var one = {two = {three = "four"}};
  	return function() {return one.two.three;};
  }
  c2 = f2();
  writeDump(c2());//returns [null] (bad)
</cfscript>
{code}


Actual Result: "four"

Expected Result: "four"

{code:java}
<cfscript>
  function f3() {
  	var one = {two = {three = "four"}};
  	return function() {return one.two["three"];};
  }
  c3 = f3();
  writeDump(c3());//returns "four" (good)
</cfscript>
{code}


Actual and Expected Result: "four"

Related URL: https://trycf.com/gist/2786e70e97f97575c7d7fb352f9cab2a/acf2018?theme=monokai

Attachments:

Comments:

Same issue in CF10, CF11 and CF2016. So this isn't a regression. Of course it should still be fixed. Thanks!, -Aaron
Comment by Aaron N.
28966 | June 06, 2018 04:36:21 AM GMT
This says fixed, but it is not fixed. Both CF2016 Update 11 and CF2018 Update 4 still have this issue. Fiddle: https://cffiddle.org/app/file?filepath=1c4bef41-380d-442d-b9db-b953d5dcd3ab/c3d102b5-209a-4d25-80da-0e7fc010f154/7136582b-4bc1-41af-8a54-7ff2a8cd8a88.cfm
Comment by Kama S.
31282 | September 05, 2019 03:24:29 AM GMT
@kama S. : this will work in the next update i. CF2016 Update 12 and CF2018 Update 5.
Comment by Ashudeep S.
31283 | September 05, 2019 05:24:58 AM GMT
@Ashudeep S. I've just checked and this was only fixed for CF2018 Update 5. It is still broken in CF2016 Update 12.
Comment by Kama S.
31409 | September 26, 2019 06:20:55 PM GMT