tracker issue : CF-3492496

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

Using array notation for an argument value while calling a method will cause other argument values to be "undefined".

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Chris Phillips / Chris Phillips (cf_chris)

Created: 01/29/2013

Components: Language, Datastructure

Versions: 10.0

Failure Type: Non Functioning

Found In Build/Fixed In Build: Final / 284722

Priority/Frequency: Critical / All users will encounter

Locale/System: English / Windows 7 64-bit

Vote Count: 3

Problem Description:

If you use array notation inside the parenthesis of a method call to assign an argument value (and that method call is inside of an "if") it will make private variables being passed in as other argument values error out as "undefined".

Furthermore, if you add a dump and/or abort it will sort of "fix" the "undefined" issue, but will NOT dump or abort.

Steps to Reproduce:

Run the file attached "index.cfm" file.

Actual Result:

Test1() will work fine.
Test2() will throw the "undefined" error for the "summary" var.
Test3() will work fine because the array literal syntax is not inside of the method call.
Test4() will work (sort of) but, should NOT. It skips right past an "abort" and magically the "summary" variable is defined. And it runs TWICE!

Expected Result:

Test1() should work fine.
Test2() should work, but, DOES NOT.
Test3() should work fine.
Test4() should "abort". And it should NOT run twice!?

Any Workarounds:

Test3() shows the only viable workaround which is to create the variable using array notation before the method call and pass it in.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3492496


External Customer Info:
External Company:  
External Customer Name: cf_chris
External Customer Email:  
External Test Config: My Hardware and Environment details:

Windows 7

ColdFusion: 10,0,7,283649

Update Level: /I:/ColdFusion/InstanceDP1/lib/updates/chf10000007.jar

(Same behavior on CF 9,0,1,274733)


  1. January 30, 2013 00:00:00: 1_index.cfm


This is the second time that this has bitten me. The more I write everything in script the more this is going to be a pain. It is definitely and without a doubt a BUG.
Comment by External U.
16468 | January 29, 2013 06:45:13 PM GMT
I want this to work so that when I'm coding, I don't have to think about whether or not I use array notation in my method arguments!
Vote by External U.
16471 | January 29, 2013 06:55:15 PM GMT
This has been causing daily issues at my company. A fix would be highly appreciated.
Vote by External U.
16472 | January 29, 2013 07:09:20 PM GMT
I would greatly appreciate a fix for this. I too have been bitten by this hard to find bug. I would prefer to reduce code bloat by passing in arguments without predefining them above the function call.
Vote by External U.
16473 | January 29, 2013 07:20:43 PM GMT
For reference here is code that will fail in CF and virtually identical code in JS that will work. <cfscript> function AbraCadabra(string arg1, array arg2) { /* I am a function to call just to demonstrate the error with calling a function. */ writeOutput('<p>AbraCadabra called: #arg1#</p>'); } function Test2() { /* I am a function that proves a serious CF bug. */ if ( true ) { var summary = 'Test2: This will NOT work (because it IS inside of an "if").'; AbraCadabra( arg1 = summary, /* 'summary' is clearly defined right above this. */ arg2 = [{id = '10100', value = 'Foo'}] ); } } try { Test2(); /* This WILL error. */ } catch( any Error ) { writeDump(var = Error, expand = true, label = "Catch from Test 2"); } </cfscript> <script type="text/javascript"> function AbraCadabra(arg1, arg2) { /* I am a function to call just to demonstrate the error with calling a function. */ console.log('<p>AbraCadabra called: ' + arg1 + '</p>'); } function Test2() { /* I am a function that shows sometimes JS is better than CF. */ if ( true ) { var summary = 'Test2: This will work (because JS is better).'; AbraCadabra( arg1 = summary, arg2 = [{id: '10100', value: 'Foo'}] ); } } Test2(); </script>
Comment by External U.
16469 | January 30, 2013 12:37:02 PM GMT
Thank you for fixing this in updater 11.
Comment by External U.
16470 | July 15, 2013 12:01:16 PM GMT