tracker issue : CF-4199998

select a category, or use search below
(searches all categories and all time range)
Title:

Cannot assign function expression to dynamic variable

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron ()

Created: 10/11/2017

Components: Language

Versions: 2016,2018

Failure Type: Others

Found In Build/Fixed In Build: 2016 / 2018,0,0,307104

Priority/Frequency: Normal /

Locale/System: / Platforms All

Vote Count: 1

This works:
<cfscript>
suffix = "Something";
"myString#suffix#" = "a string";
writeDump(variables);
</cfscript>

*This* works:
<cfscript>
myFunctionSomething = function (){};
writeDump(variables);
</cfscript>

This should work, but does not:
<cfscript>
suffix = "Something";
"myFunction#suffix#" = function (){};
writeDump(variables);
</cfscript>

Error:
Invalid CFML construct found on line 3 at column 1.

ColdFusion was looking at the following text:
/"

 
The error occurred in C:/apps/adobe/ColdFusion/2016/express/cfusion/wwwroot/CF2018/src/misc/functionExpressionWithDynamicName.cfm: line 3
1 : <cfscript>
2 : suffix = "Something";
3 : "myFunction#suffix#" = function (){};
4 : writeDump(variables);
5 : </cfscript>

This is a simplified repro case, natch.

NB, this also works:
<cfscript>
suffix = "Something";
variables["myFunction#suffix#"] = function (){};
writeDump(variables);
</cfscript>

But that's beside the point. The version that breaks should also work.

Attachments:

Comments:

+1 - the erroring example should work
Vote by Aaron N.
240 | January 31, 2018 08:15:52 AM GMT
Hi Adobe, This was fixed for non-final variables, but not fixed for final variables. Filed as https://tracker.adobe.com/#/view/CF-4202131 Thanks!, -Aaron
Comment by Aaron N.
27539 | April 26, 2018 12:06:53 AM GMT