tracker issue : CF-4202543

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

[ANeff] Bug for: NULL is not final

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/AsDesigned

Reporter/Name(from Bugbase): Aaron Neff / ()

Created: 05/21/2018

Components: Language, Null Support

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2018.0.01.308605 (PreRelease) /

Priority/Frequency: Normal / Some users will encounter

Locale/System: / Platforms All

Vote Count: 1

Issue: NULL is not final

Steps to Reproduce:
1) Run:
-----------
<cfscript>
  null = "asdf"
  foo = variables.null
  bar = null
  writeDump(variables)
</cfscript>
-----------

Actual Result:
-----------
struct

BAR: asdf
FOO: asdf
NULL: asdf
-----------

Expected Result:
-----------
struct

BAR: [null]
FOO: asdf
NULL: asdf
-----------

2) Run:
-----------
<cfscript>
  function null() {
    var bar = null
    return bar
  }
  writeDump(null())
  writeDump(variables)
</cfscript>
-----------

Actual Result:
-----------
function null

Arguments: none 
ReturnType: Any 
Roles:  
Access: public 
Output:   
DisplayName:  
Hint:  
Description:  

struct

NULL:  
  [function]
  Arguments: none 
  ReturnType: Any 
  Roles:  
  Access: public 
  Output:   
  DisplayName:  
  Hint:  
  Description:  
-----------

Expected Result:
-----------
[null]

struct

NULL:  
  [function]
  Arguments: none 
  ReturnType: Any 
  Roles:  
  Access: public 
  Output:   
  DisplayName:  
  Hint:  
  Description: 
-----------

Suggestions:
1) `bar=null` should always be shorthand for `bar=javaCast("null","")`
2) `var bar=null` should always be shorthand for `var bar=javaCast("null","")`
3) scoping is required, in order to set bar equal to the value of a variable named null (ex: `bar=variables.null` and `var bar=local.null`)

Related post: http://blog.cfaether.com/2018/05/null-can-be-overridden.html

Attachments:

Comments:

with null support enabled, this use case is invalidated since "null" is a keyword, and its use as a variable name is prohibited. with null support disabled, the output is as expected: (verified w/ CF2018u7) --------------------------------------------------------------------------- output for the test case below: function null Arguments: none ReturnType: Any Roles: Access: public Output: DisplayName: Hint: Description: struct NULL: [function] Arguments: none ReturnType: Any Roles: Access: public Output: DisplayName: Hint: Description: nullTest-f struct BAR: asdf FOO: asdf NULL: asdf --------------------------------------------------------------------------- <cfscript> function null() { var bar = null return bar } writeDump(null()) writeDump(variables) </cfscript> <cfscript> writeOutput(application.applicationname); null = "asdf" foo = variables.null bar = null writeDump(variables) </cfscript>
Comment by Piyush K.
33273 | March 07, 2020 07:32:21 AM GMT