Showing posts with label NULL support. Show all posts
Showing posts with label NULL support. Show all posts

Monday, May 21, 2018

CF-4202544 - NULL cannot be made final

Issue: NULL cannot be made final

Steps to Reproduce:
1) Run:

<cfscript>
  final null = null
  writeDump(null)
</cfscript>

Actual Result: coldfusion.runtime.UndefinedVariableException on line 2

Expected Result: [null]

Suggestion: `final null = null` should be allowed, to prevent NULL from being overridden

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

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.

Sunday, May 20, 2018

CF-4202539 - cannot assign null to variables in some scopes from CFC

Issue: cannot assign null to variables in some scopes from CFC

Steps to Reproduce:
1) Enable NULL support
2) Create Application.cfc having:

component {
  THIS.name = "MyApp"
  THIS.applicationTimeout = createTimeSpan(0,0,0,10)
  THIS.sessionManagement = true
  THIS.sessionTimeout = createTimeSpan(0,0,0,10)
  THIS.enableNULLSupport=true
}

3) Create MyCFC.cfc having:

component {function f() {FORM.foo = null}}

4) Run index.cfm containing:

<cfscript>
  invoke("MyCFC", "f")
  writeDump(isNULL(FORM.foo))
</cfscript>

Actual and Expected Result: YES

5) In MyCFC.cfc, change FORM.foo to URL.foo

6) Run index.cfm containing:

<cfscript>
  invoke("MyCFC", "f")
  writeDump(isNULL(URL.foo))
</cfscript>

Actual and Expected Result: YES

7) In MyCFC.cfc, change URL.foo to SERVER.foo

8) Run index.cfm containing:

<cfscript>
  invoke("MyCFC", "f")
  writeDump(isNULL(SERVER.foo))
</cfscript>

Actual and Expected Result: YES

9) In MyCFC.cfc, change SERVER.foo to REQUEST.foo

10) Run index.cfm containing:

<cfscript>
  invoke("MyCFC", "f")
  writeDump(isNULL(REQUEST.foo))
</cfscript>

Actual Result: coldfusion.runtime.UndefinedElementException: Element FOO is undefined in a Java object of type class coldfusion.runtime.RequestScope.

Expected Result: YES

11) In MyCFC.cfc, change REQUEST.foo to SESSION.foo

12) Run index.cfm containing:

<cfscript>
  invoke("MyCFC", "f")
  writeDump(isNULL(SESSION.foo))
</cfscript>

Actual Result: coldfusion.runtime.UndefinedElementException: Element FOO is undefined in a Java object of type class coldfusion.runtime.MemorySessionScope.

Expected Result: YES

13) In MyCFC.cfc, change SESSION.foo to APPLICATION.foo

14) Run index.cfm containing:

<cfscript>
  invoke("MyCFC", "f")
  writeDump(isNULL(APPLICATION.foo))
</cfscript>

Actual Result: coldfusion.runtime.UndefinedElementException: Element FOO is undefined in a Java object of type class coldfusion.runtime.ApplicationScope.

Expected Result: YES

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

CF-4202538 - null breaks accessors if default defined

Issue: null breaks accessors if default defined

Steps to Reproduce:
1) Enable NULL support
2) Create index.cfm having:

<cfscript>
  o = new MyCFC()
  writeDump(o.f())
</cfscript>

3) Create MyCFC.cfc having:

component accessors=true {
  property name="myProperty"
  function f() {
  setMyProperty("bar")
  //setMyProperty(null)
  return getMyProperty()
  }
}

4) Run index.cfm

Actual and Expected Result: bar

5) Run index.cfm after changing MyCFC.cfc to:

component accessors=true {
  property name="myProperty"
  function f() {
  setMyProperty("bar")
  setMyProperty(null)
  return getMyProperty()
  }
}

Actual and Expected Result: [null]

6) Run index.cfm after changing MyCFC.cfc to:

component accessors=true {
  property name="myProperty" default="foo"
  function f() {
  setMyProperty("bar")
  setMyProperty(null)
  return getMyProperty()
  }
}

Actual Result: foo

Expected Result: [null]

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

CF-4202537 - dump hides object methods

Issue: dump hides object methods

Steps to Reproduce:
1) Enable NULL support
2) Create MyCFC.cfc having component {function f() {return local}}
3) Run:

<cfscript>
  o = new MyCFC()
  writeDump(o.f())
</cfscript>

Actual Result:

struct
ARGUMENTS
struct [empty]
THIS
component MyCFC

Expected Result (and actual result w/ NULL support disabled):

struct
ARGUMENTS
struct [empty]
THIS
component MyCFC
METHODS
F
function f
Arguments: none
ReturnType: Any
Roles:  
Access: public
Output:  
DisplayName:  
Hint:  
Description:  
Verified in build 2018.0.01.308605 (PreRelease).
Filed as CF-4202537.

CF-4202536 - local scope has THIS in .cfm

Issue: local scope has THIS in .cfm

Steps to Reproduce:
1) Enable NULL support
2) Run in a .cfm:

<cfscript>
  function f() {
  return local
  }
  writeDump(f())
</cfscript>

Actual Result (with NULL support enabled):

struct
ARGUMENTS
struct [empty]
THIS [null]

Expected Result (and actual result with NULL support disabled):

struct
ARGUMENTS
struct [empty]
Verified in build 2018.0.01.308605 (PreRelease).
Filed as CF-4202536.
Update: Issue also exists in threads:
<cfscript>
cfthread(name="myThread1"){variables.foo1 = duplicate(local)}
thread name="myThread2" {variables.foo2 = duplicate(local)}
cfthread(action="join", name="myThread1,myThread2")
writeOutput(foo1.keyExists("this"))
writeOutput(foo2.keyExists("this"))
</cfscript>

Actual Result: YESYES

Expected Result (and actual result when NULL support is disabled): NONO

CF-4202535 - dump displays local scope as [undefined struct element]

Issue: dump displays local scope as [undefined struct element]

Steps to Reproduce:
1) Enable NULL support
2) Run:

<cfscript>
  function f() {
    myVar = NULL//if this isn't commented-out, r is displayed as [undefined struct element]
    return local
  }
  r = f()
  writeDump(variables)
</cfscript>

Actual Result:

struct
F
function f
Arguments: none
ReturnType: Any
Roles:  
Access: public
Output:  
DisplayName:  
Hint:  
Description:  
MYVAR [null]
R [undefined struct element]

Expected Result:

struct
F
function f
Arguments: none
ReturnType: Any
Roles:  
Access: public
Output:  
DisplayName:  
Hint:  
Description:  
MYVAR [null]
R
struct
ARGUMENTS
struct [empty]
Verified in build 2018.0.01.308605 (PreRelease).
Filed as CF-4202535.
Update: Another Repro:
<cfscript>
cfthread(name="myThread1"){variables.foo1 = duplicate(local)}
thread name="myThread2" {variables.foo2 = duplicate(local)}
cfthread(action="join", name="myThread1,myThread2")
writeDump([foo1,foo2])
writeDump({foo1=foo1,foo2=foo2})
</cfscript>

Actual Result: 1st dump's foo2 displayed as [undefined array element] and 2nd dump's foo2 displayed as [undefined struct element]

Expected Result: Both dump's foo2 properly displayed

Saturday, May 19, 2018

CF-4202534 - variable named NULL spawns in variables scope

Issue: variable named NULL spawns in variables scope

Steps to Reproduce:
1) Enable NULL support
2) Run:

<cfscript>
  myVar = NULL
  writeDump(variables)
</cfscript>

Actual Result:

struct
MYVAR [null]
NULL [null]

Expected Result:

struct
MYVAR [null]
Verified in build 2018.0.01.308605 (PreRelease).
Filed as CF-4202534.
Update: Issue also occurs for URL.myVar=null, FORM.myVar=null, REQUEST.myVar=null, SESSION.myVar=null, APPLICATION.myVar=null and SERVER.myVar=null. It doesn't matter what scope. A variable named `NULL` always spawns into variables scope.

ColdFusion member functions for XML object management

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