tracker issue : CF-3818770

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

Elvis operator executes RHS (right hand side) when it doesn't need to.

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Raymond Camden / Raymond Camden (Raymond Camden)

Created: 09/04/2014

Components: Language

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / All users will encounter

Locale/System: English / Mac 10 All

Vote Count: 8

Listed in the version 11.0.03.292480 Issues Fixed doc
Consider this example:

<cfscript>
	
	function getfoo() {
		writeoutput("do you see me?");
		return "foo";	
	}
	
	username = encodeForHTML(url.name) ?: "Anonymous";
	writeOutput(username);
	
	u2 = encodeForHTML(url.name) ?: getfoo();
</cfscript>


If url.name exists, then getfoo() should not execute, but it does.

Both Railo/Groovy handle the RHS side correctly.

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

Watson Bug ID:	3818770

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

Attachments:

Comments:

Sigh. +1 vote to fix. "Vote must be between 25 and 4000 characters". Now it is.
Vote by External U.
11059 | September 04, 2014 04:29:59 PM GMT
+1 "Uh, we had a slight weapons malfunction, but uh... everything's perfectly all right now. We're fine. We're all fine here now, thank you. How are you?" - Han Solo, Star Wars
Vote by External U.
11060 | September 04, 2014 04:46:53 PM GMT
+1 "Just remember what ol' Jack Burton does when the earth quakes, and the poison arrows fall from the sky, and the pillars of Heaven shake. Yeah, Jack Burton just looks that big ol' storm right square in the eye and he says, 'Give me your best shot, pal. I can take it.'"
Vote by External U.
11061 | September 04, 2014 06:24:54 PM GMT
Should function in line with the languages that inspired this feature, namely Groovy.
Vote by External U.
11062 | September 04, 2014 06:56:20 PM GMT
+1 ********** filler **********
Vote by External U.
11063 | September 04, 2014 08:02:08 PM GMT
Do not try and bend the spoon. That's impossible. Instead, only realize the truth... THERE IS NO SPOON. Then you will see that it not the spoon that bends, it is yourself.
Vote by External U.
11064 | September 05, 2014 01:21:29 AM GMT
************************************** **************************************
Vote by External U.
11065 | September 05, 2014 02:29:22 AM GMT
+1 "I picked the wrong week to quit sniffing glue"
Vote by External U.
11066 | September 05, 2014 06:20:14 AM GMT
I've verified this is fixed in CF11 Update 3. Thanks!, -Aaron
Comment by External U.
11056 | November 05, 2014 04:48:33 PM GMT
Actually, there is a regression in CF11 Update 3. <cfscript> //foo = "A"; writeOutput(foo ?: "B"); </cfscript> 11,0,0,289822: Returns "A" when foo exists, otherwise returns "B" 11,0,03,292024(PreRelease): Returns "A" when foo exists, otherwise returns lowercase "b" In possiblyNullValue?:valueIfNull, valueIfNull is now returned as lowercase. Thanks!, -Aaron
Comment by External U.
11057 | November 14, 2014 01:58:35 AM GMT
I have logged a separate bug CF-3851922 for this. (Comment added from ex-user id:nawani)
Comment by Adobe D.
11058 | November 14, 2014 04:24:10 AM GMT