tracker issue : CF-4200233

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

Elvis Operator Bug

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/DesignLimitation

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

Created: 11/30/2017

Components: Language, General

Versions: 11.0

Failure Type: Incorrectly 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: 0

Problem Description:
The elvis operator does not work when using a variable as a struct key. 

Steps to Reproduce:

{code:java}
?<cfscript>
	function test() {
		var foo = {
			test_123456 = "result"
		};
		var key = "test_123456";
		var result = foo[key] ?: "undefined!"; 
		WriteOutput(result);	
	}
	test();
</cfscript>
{code}

Actual Result:
"undefined!"

Expected Result:
"result"

Any Workarounds:
Use IsDefined()

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
178 | December 01, 2017 08:04:43 AM GMT
This is a duplicate of CF-3952818 which Adobe has indicated they will not fix for ACF11.
Comment by Samuel Knowlton
27606 | April 30, 2018 02:10:28 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
29271 | July 11, 2018 05:31:49 AM GMT
Elvis core engine is totally different in CF11 from CF2016. Changes can not be ported back. 
Comment by Awdhesh Kumar
29836 | September 17, 2018 10:38:00 AM GMT
If changes cannot be ported back, then the CF11 documentation should be updated to let users know that the feature has a bug. I lost hours on this.
Comment by Fred Leefarr
29837 | October 24, 2018 10:19:56 AM GMT