Status/Resolution/Reason: To Fix//BugReVerified
Reporter/Name(from Bugbase): Reyna J. / ()
Created: 09/11/2019
Components: Language
Versions: 2018
Failure Type: Incorrectly functioning
Found In Build/Fixed In Build: Update 4 /
Priority/Frequency: Normal / Few users will encounter
Locale/System: English / Win 2016
Vote Count: 2
Problem Description:
Short circuiting doesn't seem to prevent implicit array creation in secondary conditional.
Steps to Reproduce:
{code:java}
<cfscript>
struct = {};
if(false && struct['key0'] == true){
writeOutput('Not going to get here');
} else {
writeOutput('Short circuiting prevents error from nonexistent key, ');
}
if(false && array[3] == true){
writeOutput('Not going to get here');
} else {
writeOutput('and here it prevents error from nonexistent index, ');
}
if(false && arrayLen( [ array[15] ] ) == 1){
writeOutput('Not going to get here');
} else {
writeOutput('but here it fails to prevent error from nonexistent index.');
}
</cfscript>
{code}
Actual Result:
ArrayBoundException: The element at position 3 of dimension 1 of array variable cannot be found.
Expected Result:
'Short circuiting prevents error from nonexistent key, and here it prevents error from nonexistent index, but here it fails to prevent error from nonexistent index.'
Any Workarounds:
Nested ifs seem to work fine.
Attachments:
Comments: