Title:
[elvis] CFML: "Elvis" operator and null coalescing operators are two different things G'day:
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)
Created: 07/30/2015
Components: Language
Versions: 11.0
Failure Type:
Found In Build/Fixed In Build: CF11_Final /
Priority/Frequency: Major / Some users will encounter
Locale/System: ALL / Platforms All
Vote Count: 9
See http://blog.adamcameron.me/2015/07/cfml-elvis-operator-and-null-coalescing.html
Bottom line:
Now the CFML version:
// elvis.cfm
writeOutput("Elvis when using false: ");
testVar = false;
writeOutput(testVar ?: "default");
writeOutput("<br>");
function nuller(){}
writeOutput("Elvis when using null: ");
writeOutput(nuller() ?: "default");
writeOutput("<br>");
Result:
Elvis when using false: false
Elvis when using null: default
Which is... wrong.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 4028653
External Customer Info:
External Company:
External Customer Name: Adam
External Customer Email:
External Test Config: My Hardware and Environment details:
Attachments:
Comments: