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.

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(...