Title:
[ANeff] Bug for: nested struct reference returns undefined/null from closure
| View in TrackerStatus/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: