tracker issue : CF-4200234

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

Elvis Operator Bug 2

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/DesignLimitation

Reporter/Name(from Bugbase): Fred Leefarr / Fred Leefarr ()

Created: 11/30/2017

Components: Language, Functions

Versions: 11.0

Failure Type: Non Functioning

Found In Build/Fixed In Build: dev /

Priority/Frequency: Normal / All users will encounter

Locale/System: UK English / Windows 10 64 bit

Vote Count: 1

Problem Description:
Elvis operator does not work as expected when using a variable for the array index

Steps to Reproduce:
?<cfscript>
	
	function test() {
		
		var arr = ["a", "b", "c"];
		
		var index = 1;
		var result = arr[index] ?: "undefined!";
		
		WriteOutput(result);

	}
	
	test();
		
</cfscript>

Actual Result:
"undefined!"

Expected Result:
"a"
Any Workarounds:

Attachments:

Comments:

Hi Fred, This bug works in the latest version of ColdFusion i.e CF 2016 . We will investigate if we can integrate the fix to CF 11. It would be great if you migrate to the latest version . :) Thanks, Suchika , ColdFusion Engineering Team
Comment by Suchika Singh
176 | December 01, 2017 08:02:18 AM GMT
This is a duplicate of CF-3952818 which Adobe has indicated they will not fix for ACF11.
Comment by Samuel Knowlton
27605 | April 30, 2018 02:10:06 PM GMT
This is one of the reasons the ColdBox framework still cannot use elvis. We need to support CF11 and bugs like this make it unusable.
Comment by Bradley Wood
29270 | July 11, 2018 05:30:07 AM GMT
Elvis core engine is totally different in CF11 from CF2016. Changes can not be ported back. 
Comment by Awdhesh Kumar
29733 | September 17, 2018 10:37:17 AM GMT