tracker issue : CF-4203093

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

Implicit array notation breaks components with built-in function name

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Joe Wakefield / ()

Created: 07/17/2018

Components: Language, Named Parameters

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2018,0,0,310739 / 2018.0.0.311644

Priority/Frequency: Normal / Few users will encounter

Locale/System: English / Linux Ubuntu 14.04

Vote Count: 0

Problem Description:
ColdFusion prevents definition of functions in the local scope if using the same name as a built-in function. However, it has always been possible to create a same-name function inside a component. This behaviour now throws a vague exception (see below) when you try to call the function with implicit array notation as a parameters. This worked in CF2018 beta, but is broken in the final release.

Steps to Reproduce:
Create two files (test.cfc & index.cfm)
=== test.cfc ===
{code:java}
component {
    function serializeJSON(required any object, boolean strictMapping) {
        return "test output";
    }
}
{code}


=== index.cfm ===
{code:java}
<cfscript>
variables.util = createObject("component", "test");
WriteDump(variables.util.serializeJSON(strictMapping=true, object={ "KEY" = "VALUE" }));
</cfscript>
{code}

=== index2.cfm ===

{code:java}
<cfscript>
variables.util = createObject("component", "test");
local.object = {
   "KEY" = "VALUE"
};
WriteDump(variables.util.serializeJSON(strictMapping=true, object=local.object));
</cfscript>
{code}

Actual Result:
index.cfm = Exception coldfusion.compiler.ASTsimpleVariableReference cannot be cast to coldfusion.compiler.ASTtagAttribute
index2.cfm = prints "test output" as expected

Expected Result:
Both index.cfm and index2.cfm should print "test output" as expected

Any Workarounds:
Don't use implicit array notation in these circumstances

Attachments:

Comments: