tracker issue : CF-3122719

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

Compile error on passing shorthand array arguments to function in if ... else

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Jan Verschueren / Jan Verschueren (Jan Verschueren)

Created: 02/24/2012

Components: Language, CF Component

Versions: 9.0.1

Failure Type: Crash

Found In Build/Fixed In Build: 9.0.1 /

Priority/Frequency: Critical / All users will encounter

Locale/System: English / Windows 7

Vote Count: 0

Problem Description:
When passing shorthand notation arrays to a function that is placed in an 'else' block, and the if ... else block is written without brackets, The server will throw a 500 internal server error.

It's important that a user-defined function is called in the 'else' block, that an shorthand array ([somevar]) is passed as an argument and that the if ... else block is used without brackets.

Steps to Reproduce:

copy or recreate following simple component code snippet:

component  output="false"
{
	remote void function init(){
		if(1==2)
    		abort;
		else
    		test(["hello"]);
	}
	
	function test(array values){
	    writeOutput(arguments.values[1]);
	}
}


Actual Result:

500

Could not initialize class cftest012ecfc124438982


Expected Result:

hello

Any Workarounds:

- use brackets in if ... else
- don't pass shorthand array to test().

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

Watson Bug ID:	3122719

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



reproduced on Windows 7 & windows server 2003

Attachments:

  1. February 29, 2012 00:00:00: 1_500-result.txt
  2. February 29, 2012 00:00:00: 2_cf-error-result.txt
  3. February 29, 2012 00:00:00: 3_500-snippet.txt
  4. February 29, 2012 00:00:00: 4_cf-error-snippet.txt
  5. February 29, 2012 00:00:00: 6_cf-error-result-cfm.txt
  6. February 29, 2012 00:00:00: 7_cf-cfm.txt
  7. February 29, 2012 00:00:00: 5_cf-error-result-cfm.txt

Comments:

When reproduced in a cfm, coldfusion throws the error " Variable ___IMPLICITARRYSTRUCTVAR0 is undefined." When reproduced with given snippet, and both if and else call test(["hello"]); coldfusion throws following error: Unable to complete CFML to Java translation. Error information coldfusion.compiler.ASTcfscriptStatement@2e3b8e96 type 11
Comment by External U.
20603 | February 24, 2012 04:48:06 AM GMT
Not Reproducible on 9,0,1,274733 without any hot fixes. Please let us know if you have applied any hot fixes. Please send the CFM and complete stacktrace as well.
Comment by Himavanth R.
20604 | February 29, 2012 07:26:20 AM GMT
I have added 4 attachments. "500-snippet.txt" results in "500-result.txt" "cf-error-snippet.txt" results in "cf-error-result.txt" the result files have a complete stack trace
Comment by External U.
20605 | February 29, 2012 08:25:46 AM GMT
reproduced on: Server Product ColdFusion Version 9,0,0,251028 Edition Developer Operating System Windows 7 OS Version 6.1 Adobe Driver Version 4.0 (Build 0005) and on: Server Product ColdFusion Version 9,0,0,251028 Edition Enterprise Operating System Windows 2003 OS Version 5.2 Adobe Driver Version 4.0 (Build 0005)
Comment by External U.
20606 | February 29, 2012 08:29:40 AM GMT
Added 2 more attachments (don't mind the filenames): cf-error-result-cfm.txt : The cfm code snippet that returns in the same situation as described a different error. Basicly the same code snippet, but in a cfm instead of cfc. cf-cfm.txt : The result error of the cfm code.
Comment by External U.
20607 | February 29, 2012 08:42:08 AM GMT
Thanks for the info Jan. You are using CF 9. This issue was fixed in CF 9.0.1 I checked that it is throwing the said error in CF 9 but not in CF 9.0.1. Please upgrade.
Comment by Himavanth R.
20608 | March 01, 2012 12:51:06 AM GMT
Ok, thanks for information
Comment by External U.
20609 | March 01, 2012 03:05:03 AM GMT