tracker issue : CF-4198548

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

Implicit array creation within a function throws null pointer exception

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Michael Clark / Michael Clark ()

Created: 04/21/2017

Components: Language, Functions

Versions: 2016,11.0

Failure Type: Non Functioning

Found In Build/Fixed In Build: 2016,0,03,300466 / latest build

Priority/Frequency: Normal / All users will encounter

Locale/System: / Win 2008 Server R2 64 bit

Vote Count: 0

Problem Description:
When creating a var scoped array implicitly in a function, a null pointer exception is thrown.

Steps to Reproduce:
Execute the following code:

<cffunction name="test">
	<cfset var result[1] = "Hello" />
	<cfreturn result />
</cffunction>

<cfdump var="#test()#" />

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

Null Pointers are another name for undefined values.

Expected Result:
Dump of the array.

Any Workarounds:
Declare the array explicitly before assigning values:

<cfset var result = [] />

Attachments:

Comments: