tracker issue : CF-4067122

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

[elvis]?: Elvis operator not properly evaluating inline CFML

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Abram Adams / Abram Adams (Abram Adams)

Created: 09/30/2015

Components: Language

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / All users will encounter

Locale/System: ALL / Linux uBuntu 11.10

Vote Count: 0

Listed in the version 2016.0.0.297996 Issues Fixed doc
When using ?: to set a default string value containing an inline CFML var it returns blank.  If you concatenate the string & var it works.  Example:

<cfscript>
 test = "VALUE THAT SHOULD OUTPUT";
 
 result1 = result1 ?: "did it work?... #test#"; 
 result2 = result2  ?: "did it work?... " & test; 
 result3 = result3 ?: "did it work?... #notevenvalidCFML#"; // this should throw an error
 
// for comparison, using the isNull() with ternary operator
result4 = !isNull( result4 ) ? result4 : "did it work?... #test#";

 writeDump({
    "result1": result1,
    "result2": result2,
    "result3": result3,
    "result4": result4
 });
 
</cfscript>

Expected result:
result3 should have thrown an error.

Missed error aside:
result1, result2 should output: did it work?... VALUE THAT SHOULD OUTPUT

Actual result:
result3 does not throw error
result1 returns: "did it work?..."
result2 and result4 properly returns: "did it work?... VALUE THAT SHOULD OUTPUT"

You can try it out yourself here:
http://trycf.com/editor/gist/0e6f6a5c44c8a4c05ae5/acf11?theme=solarized_dark

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

Watson Bug ID:	4067122

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

Attachments:

Comments: