Last active
October 20, 2022 15:41
-
-
Save JamoCA/55db04881d0c6f5aadfcf946625049a2 to your computer and use it in GitHub Desktop.
Should a ColdFusion/CFML object change (by reference) when being passed as an argument/attribute collection parameter?
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
<cfparam name="attributes.var1" default="value1"> | |
<cfparam name="attributes.var2" default="value2"> |
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
<!--- 20221020 Should a ColdFusion/CFML object change (by reference) when being passed as an argument/attribute collection parameter? | |
Using CF20201, it's inconsistent and changes w/customtag + attributecollection, but not with function + argumentcollection. | |
Twitter: https://twitter.com/gamesover/status/1582874779547095042 | |
Gist: https://gist.github.com/JamoCA/55db04881d0c6f5aadfcf946625049a2 | |
Adobe Documentation: https://helpx.adobe.com/coldfusion/developing-applications/building-blocks-of-coldfusion-applications/writing-and-calling-user-defined-functions/working-with-arguments-and-variables-in-functions.html | |
---> | |
<cfscript> | |
void function argumentsTest(var1="value1", var2="value2"){}; | |
payload = ["var0":now()]; | |
argumentsTest(argumentcollection=payload); | |
writedump(var=payload, label="udf arguments: should only contain 'var0'."); | |
writeoutput("<br>"); | |
payload = ["var0":now()]; | |
cf_attributesTest(attributecollection=payload); | |
writedump(var=payload, label="cftag attributes: should only contain 'var0'."); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment