Monday, May 21, 2018

CF-4202543 - NULL is not final

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 null
Arguments: none
ReturnType: Any
Roles:  
Access: public
Output:  
DisplayName:  
Hint:  
Description:  

Expected Result:

[null]
struct
NULL
function null
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`)

Verified in build 2018.0.01.308605 (PreRelease).
Filed as CF-4202543.

No comments:

Post a Comment

ColdFusion member functions for XML object management

Prior to ColdFusion 2018, ColdFusion supported the following XML member functions : .elemNew() (equivalent of XmlElemNew ) .childPos(...