tracker issue : CF-4198314

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

Implicitly declare array fails when var scoped

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Jake Munson / Jake Munson ()

Created: 02/03/2017

Components: Language, Functions

Versions: 11.0

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: CF 11 Update 11 / 11,0,12,302277

Priority/Frequency: Normal / Most users will encounter

Locale/System: / Win 2008 Server R2 64 bit

Vote Count: 2

Problem Description: CF Update 11 for ColdFusion 11 has a bug with implicit array declaration inside cffunction. If you var scope a variable that is implicitly declared, CF throws an error.

Steps to Reproduce:
Apply the Update 11 patch to a ColdFusion 11 server.
Run this code on a test page:
<cfset testFunc()>
<cffunction name="testFunc">
   <cfset var testArray[1] = "">
</cffunction>

Actual Result:
An error: "The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code."

Expected Result:
Code runs without error.

Any Workarounds:
Uninstall Update 11. Or, declare the variable first instead of using implicit declaration:
<cfset var testArray = arrayNew(1)>

Attachments:

Comments:

This happens for me as well. Please issue a hotfix as soon as possible.
Vote by James S.
1242 | February 03, 2017 06:54:26 PM GMT
I wanted to double check that the code in the "Steps to Reproduce" section is indeed valid ColdFusion syntax. I found the following CF documentation page that shows implicitly creating an array in the same manner as shown above: https://helpx.adobe.com/coldfusion/developing-applications/the-cfml-programming-language/using-arrays-and-structures/basic-array-techniques.html Here is the code in that example: <cfset chPar[2] = "Parker">
Comment by Jake M.
1237 | February 06, 2017 10:17:59 PM GMT
Yes, I found that as well. Thanks Jake for posting this. Adobe: Any timeline on when we can expect a hotfix?
Comment by James S.
1238 | February 07, 2017 03:44:33 PM GMT
Hi all, I've confirmed that the following works in CF2016 Update 1 (build 2016.0.01.298513) and Update 3 (build 2016.0.03.300466) and CF11 Update 7 (build 11,0,07,296330): <cfscript> myArray[2] = "foobar"; writeDump(myArray);//returns [undefined array element, "foobar"] </cfscript> So, yes, if it doesn't work in CF11 Update 11, then I too agree it's a bug. Just thought I'd check some other config's and relay the result. Thanks!, -Aaron
Comment by Aaron N.
1239 | February 10, 2017 04:48:11 AM GMT
@Aaron, Actually, your example code does not create an error on CF 11 Update 11. The bug only manifests when you var scope the array inside a function. I modified your example code to this: <cfscript> writeDump(foo()); private array function foo() { var myArray[2] = "foobar"; return myArray; } </cfscript> When I run this code on CF 11 Update 11, I get the error described above in the bug. However, if I run this same code on CF 11 Update 10, I see the array dump as expected (no error).
Comment by Jake M.
1240 | February 14, 2017 08:49:44 PM GMT
subscribe
Comment by Matthew C.
1241 | February 15, 2017 10:06:17 PM GMT