Status/Resolution/Reason: To Fix//BugVerified
Reporter/Name(from Bugbase): Aaron Neff / ()
Created: 05/09/2018
Versions: 2016,11.0,2018
Failure Type: Incorrectly functioning
Found In Build/Fixed In Build: 2018.0.01.308605 (PreRelease) /
Priority/Frequency: Normal / Very few users will encounter
Locale/System: / Platforms All
Vote Count: 0
Issue: var is sometimes ignored (Lucee correct)
Repro:
<cfscript>
application.delete("foo");
session.delete("foo");
function f() {
//Begin CF workaround
/*var application={};
var session={};
var request={};
var form={};
var url={};
var variables={};*/
//End CF workaround
var application.foo = "bar";
var session.foo = "bar";
var request.foo = "bar";
var form.foo = "bar";
var url.foo = "bar";
var variables.foo = "bar";
return local;
}
writeDump(var=f(), label="f()");
writeDump(var=application, label="application");
writeDump(var=session, label="session");
writeDump(var=request, label="request");
writeDump(var=form, label="form");
writeDump(var=url, label="url");
writeDump(var=variables, label="variables");
</cfscript>
Actual Result: In CF, local scope contains none of the `var`d variables (bad). In Lucee, `var` always means local scope, so the local scope contains all of the `var`d variables (good).
Expected Result: In CF and Lucee, local scope contains all of the `var`d variables.
Workaround: Uncomment the "Begin/End CF workaround" section.
Suggestion: Since `var` must always mean local-scope, any existing code using `var` to create a non-local-scope variable is broken. Therefore, backward-compat must not be maintained. Lucee has the correct behavior here.
Attachments:
Comments: