tracker issue : CF-3790842

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

Implicit Array passed as named parameter to function in block ignores functions

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Justin Treher / Justin Treher (Justin Treher)

Created: 07/17/2014

Components: Core Runtime

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: Final /

Priority/Frequency: Normal / Most users will encounter

Locale/System: English / Win All

Vote Count: 0

Problem Description:

When you call a method passing an implicit array as a named parameter to a function inside of a conditional block (I haven't tested others), it will ignore any function call above that method call to the start of the block (easy to visualize with code below). Any code but a method call will cause it not to ignore. If this is executing outside of a block, it will correctly include the missing method. 

Steps to Reproduce:

<cfscript>

testArrayBug();

function testArrayBug(){
		if( true){
			// this function will be ignored. If you move it below
			// test ArrayBugSecond, it will show up.
			testArrayBugFirst();
			testArrayBugSecond(test =["one","two","three"]);
		}

}

function testArrayBugFirst(array test = []){
	writeDump(local);
}

function testArrayBugSecond(array test = []){
	//do nothing
}

</cfscript>

Actual Result:

Black page.

Expected Result:

A dump of local.

Any Workarounds:

You can declare your array outside of the method call to get around the implicit array creation engine stripping out your function call. You can pass in arguments by position rather than named.

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

Watson Bug ID:	3790842

External Customer Info:
External Company:  
External Customer Name: j_treher
External Customer Email:  
External Test Config: IIS, ColdFusion 10

Attachments:

Comments:

Ok, sorry, this looks to have been fixed in updater 11. I was on 10.
Comment by External U.
11609 | July 17, 2014 12:31:03 PM GMT
This sounds like a duplicate of https://bugbase.adobe.com/index.cfm?event=bug&id=CF-3482734. -- Adam
Comment by External U.
11610 | July 19, 2014 04:00:41 AM GMT
Here is another test case that is still broken. function testArrayBug(){ if( true){ var foo = "test"; testArrayBugSecond(test =["one" & foo]); } } versus here it working function testArrayBug(){ var foo = "test"; if( true){ testArrayBugSecond(test =["one" & foo]); } }
Comment by External U.
11611 | July 21, 2014 01:04:18 PM GMT
So, basically, this bug should not be closed, but it the example above should be replaced with my example below. I couldn't find the original bug Adam mentioned because searching for "implicit" did not bring up that result.
Comment by External U.
11612 | July 21, 2014 01:05:32 PM GMT
Just to verify: your example below is broken on CF9 & CF10, but is fixed in CF11. -- Adam
Comment by External U.
11613 | July 22, 2014 02:31:28 AM GMT