Created
April 8, 2022 18:06
-
-
Save adamcameron/a62d1e9ec8db0c4c37d08ee952d5efc8 to your computer and use it in GitHub Desktop.
Demonstrates what seems to be a bug in how Lucee scopes the cfftp variable when in modern mode: it still goes in the variables scope.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
serverDetails = { | |
server="ftp.dlptest.com", | |
username="dlpuser", | |
password="rNrKYTX9g7z3RgJRmxWuGHbeu" | |
} | |
function usingClassicMode() localmode="classic" { | |
cfftp(connection="c1", action="open", attributeCollection=serverDetails) | |
cfftp(connection="c2", action="open", attributeCollection=serverDetails, result="c2ConnectionResult") | |
writeDump(label=getFunctionCalledName(), var=[ | |
"cfftp is in variables" = structKeyExists(variables, "cfftp"), | |
"c2ConnectionResult is in variables" = structKeyExists(variables, "c2ConnectionResult"), | |
"cfftp is in local?" = structKeyExists(local, "cfftp"), | |
"c2ConnectionResult is in local?" = structKeyExists(local, "c2ConnectionResult") | |
]) | |
} | |
function usingModernMode() localmode="modern" { | |
cfftp(connection="c3", action="open", attributeCollection=serverDetails) | |
cfftp(connection="c4", action="open", attributeCollection=serverDetails, result="c4ConnectionResult") | |
writeDump(label=getFunctionCalledName(), var=[ | |
"cfftp is in variables" = structKeyExists(variables, "cfftp"), // TRUE, but should be fale | |
"c2ConnectionResult is in variables" = structKeyExists(variables, "c4ConnectionResult"), | |
"cfftp is in local?" = structKeyExists(local, "cfftp"), | |
"c2ConnectionResult is in local?" = structKeyExists(local, "c4ConnectionResult") | |
]) | |
} | |
usingClassicMode() | |
usingModernMode() | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment