Status/Resolution/Reason: Closed/Fixed/Fixed
Reporter/Name(from Bugbase): Aaron Neff / ()
Created: 06/06/2018
Components: Language, Null Support
Versions: 2018
Failure Type: Data Corruption
Found In Build/Fixed In Build: 2018.0.01.308605 (PreRelease) / 2018,0,0,310306
Priority/Frequency: Normal / Most users will encounter
Locale/System: / Windows 10 64 bit
Vote Count: 0
Issue: null support ignores conditionals
Steps to Reproduce:
1) Enable NULL support
2) Run this:
<cfscript>
if(false)
{foo="bar"}
writeOutput(variables.keyExists("foo"))//returns YES (bad)
writeOutput(isNull("variables.foo"))//returns YES (bad)
writeOutput(isNull("foo"))//throws Variable FOO is undefined. (good)
</cfscript>
Actual Result: YES YES UndefinedVariableException
Expected Result: NO NO UndefinedVariableException
3) Run this:
<cfscript>
function f() {
var someValue = "a"
switch(someValue) {
case "b":
{ var foo = "bar" break }
}
return local.keyExists("foo")
}
writeDump(f())//returns YES (bad)
</cfscript>
Actual Result: YES
Expected Result: NO
4) Run this:
<cfscript>
myArray=[]
for(element in myArray)
{ foo = "bar" }
writeDump(variables.keyExists("foo"))//returns YES (bad)
</cfscript>
Actual Result: YES
Expected Result: NO
Wow!!
Do I really need to test every scenario? Adobe, if you think it's okay for variables to exist before their creation: no, it's not okay!
I guarantee this is going to break a TON of code. Checking for existence of variables, and making decisions upon that, is common.
Attachments:
Comments: