tracker issue : CF-3594992

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

Using inline structs in as named arguments inside a block in cfscript causes CF not to execute code.

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Peter Boughton / Peter Boughton (Peter Boughton)

Created: 07/15/2013

Components: Core Runtime

Versions: 10.0

Failure Type: Non Functioning

Found In Build/Fixed In Build: Final / CF10 Update16

Priority/Frequency: Critical / All users will encounter

Locale/System: English / Platforms All

Vote Count: 0

Problem Description:
As per title - in certain situations lines of code do not execute - the parser appears to get confused by inline structs inside function calls - but only if using named arguments and inside a block (if/for/try/etc).

This is very similar issue to https://bugbase.adobe.com/index.cfm?event=bug&id=3482734 - however, whilst that issue was "fixed" in CF10 update 11, the code below still errors on 10,0,11,285437

Steps to reproduce:

	<cftry>
		<li>Example 1 - named argument, inline struct referencing variable, inside if block.
	<cfscript>

			if ( true )
			{
				IgnoredVar = 1;
				writeOutput(StructKeyExists(Variables,'IgnoredVar') );

				doStuff
					( Type = 'json'
					, Data = { success:false , error:IgnoredVar }
					);

				writeOutput(StructKeyExists(Variables,'IgnoredVar') );
				StructDelete(Variables,'IgnoredVar');
			}

	</cfscript>
	<cfcatch>
		<cfoutput><b style="color:red">Failed</b>: #cfcatch.message#</cfoutput>
	</cfcatch>
	</cftry>

	<cffunction name="doStuff" output=1 >
		<cfargument name="type" />
		<cfargument name="data" default=#{undefined:1}# />
		<b style="color:green">function called</b> #StructKeyList(Arguments)# #StructKeyList(Arguments.Data)#
	</cffunction>

See attached code for further examples...

Expected result:
No error.

Any Workarounds:
1. Create struct as variable before function call.
2. Use Railo, which doesn't have any issues.

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

Watson Bug ID:	3594992

External Customer Info:
External Company:  
External Customer Name: boughtonp
External Customer Email:  
External Test Config: ColdFusion 10,0,11,285437

Attachments:

  1. July 15, 2013 00:00:00: 1_cf_ignored_code.cfm

Comments:

testcase added at ColdFusion\qa\cf\regression\newmanual\coreruntime\bugs\bugCF-3594992.cfm
Comment by Suchika S.
14964 | November 27, 2013 12:27:13 AM GMT
This is still not fixed with update 14. Please reopen. <cfscript> test(); function test(){ var arr = []; for( var item in arr){ create( intervals = { x = 1 } ); } } function create( struct intervals ){ return; } </cfscript>
Comment by External U.
14965 | October 16, 2014 07:44:16 AM GMT
Oddly enough, if you set the var item = ""; outside of the for loop, the code below will work.
Comment by External U.
14966 | October 16, 2014 08:06:23 AM GMT
This is fixed in ColdFusion 11 but was not part of ColdFusion 10 update 14.
Comment by Rupesh K.
14967 | October 27, 2014 08:22:21 AM GMT
@Rupesh, Will you be backporting the fix to CF10 in a future update?
Comment by External U.
14968 | October 27, 2014 03:20:07 PM GMT
Sure, we will include it in the next update for CF 10.
Comment by Rupesh K.
14969 | October 28, 2014 01:21:26 AM GMT
Cheers Rupesh! :-)
Comment by External U.
14970 | October 28, 2014 01:49:03 PM GMT
The fix for this bug is available in the pre-release build of ColdFusion 10 Update 16
Comment by CFwatson U.
14971 | February 20, 2015 09:22:28 AM GMT