Status/Resolution/Reason: Closed/Withdrawn/NotABug
Reporter/Name(from Bugbase): A. Bakia / A. Bakia (A. Bakia)
Created: 03/09/2016
Components: Language
Versions: 2016
Failure Type: Unspecified
Found In Build/Fixed In Build: Alpha_v12 /
Priority/Frequency: Trivial / Unknown
Locale/System: English / Win All
Vote Count: 1
Problem Description: According to the new Safe Navigation operator (?.), the expression,
<cfoutput>#employee?.getDesignation#</cfoutput>
is equivalent to
<cfif isDefined('variables.employee') and structKeyExists(employee,'getDesignation')>
<cfoutput>#employee.getDesignation#</cfoutput>
<cfelse>
</cfif>
This logic is inconsistent, as it implies that an undefined variable is equal to an empty string.
Steps to Reproduce: Run a CFM page containing just this line:
noneExistentStructure?.arbitraryKeyName is '': <cfoutput>#noneExistentStructure?.arbitraryKeyName is ''#</cfoutput>
Actual Result:
noneExistentStructure?.arbitraryKeyName is '': YES
Expected Result: I expect no such operator, and would discourage its use. It is analogous to an attempt to mask smoke. The undefinedness of a variable is a reminder there is a fire to attend to.
Any Workarounds:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 4126691
External Customer Info:
External Company: (withheld for privacy)
External Customer Name: A. Bakia
External Customer Email: A.BAKIG@CHELLO.NL
External Test Config:
Attachments:
Comments: