Title:
Setting non-scoped variable in a udf in CF2016 behaves differently from CF11
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Mingo Hagen / Mingo Hagen (Mingo Hagen)
Created: 02/19/2016
Versions: 2016
Failure Type:
Found In Build/Fixed In Build: CF2016_Final /
Priority/Frequency: Major / Some users will encounter
Locale/System: ALL / Platforms All
Vote Count: 11
Related Bugs:
CF-4031746 - Similar to
Problem Description:
Setting a non-scoped variable in a udf in CF2016 behaves differently from CF11. In CF11 the repro code below would work, now it throws an error.
Steps to Reproduce:
<cfscript>
function foo( bar ) {
bar = "test";
writeDump( arguments.bar );
}
foo();
</cfscript>
Actual Result:
Element BAR is undefined in ARGUMENTS.
The error occurred in {path-to}/index.cfm: line 4
2 : function foo( bar ) {
3 : bar = "test";
4 : writeDump( arguments.bar );
5 : }
6 :
Expected Result:
According to the scope priority in the CF docs, I would think setting without scope would fall back to arguments.bar (since there is an argument named bar) and then to local.bar, but the code above sets variables.bar to "test".
Any Workarounds:
use explicit scopes
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 4119653
External Customer Info:
External Company:
External Customer Name: Mingo Hagen
External Customer Email:
External Test Config: My Hardware and Environment details:
CF2016 on Windows 10
Attachments:
Comments: