Friday, May 25, 2018

RE: Upgrade path to ColdFusion (2018 release)

This post is regarding the "Upgrade path to ColdFusion (2018 release)" post at the ColdFusion Community Portal. It looks like Adobe's website only offers the ColdFusion (2016 release) full license and not the upgrade license?

Steps to Reproduce: 1) Visit www.coldfusion.com
2) See this:

3) Click any of the "Buy Now" buttons
4) See this:

5) Go back www.coldfusion.com and scroll to the bottom
6) See this:

7) Click the Standard Edition's "Buy Now" button
8) See this:

Question: How does one choose the upgrade license?

Thursday, May 24, 2018

CF-4202602 - REST method compile time error says wrong file

Issue: REST method compile time error says wrong file

Steps to Reproduce:
1) unzip CF-4202602.zip (attached to ticket)
2) In CF Admin, create "mymapping" mapping to unzipped app's directory
3) run index.cfm to register REST app
4) run mypage.cfm

Actual Result:

The error occurred in {path}/MyCFC.cfc: line 4

2 : component rest=true restpath="a" {
3 :   remote string function returnVoid(string c restargsource="path") httpmethod="GET" restpath="b/{c}" produces="application/json" {
4 :     o = new mymapping.myOtherCFC();
5 :     return serializeJSON(ARGUMENTS.c == 'c' ? 'c' : '');
6 :   }

Expected Result:

The error occurred in {path}/MyOtherCFC.cfc: line 2

1 : component {
2 :   function f() {compileTime=}
3 : }

Note: If `function f() {compileTime=}` is changed to `compileTime` in MyOtherCFC.cfc, then error shows correct file:

The error occurred in {path}/MyOtherCFC.cfc: line 2

1 : component {
2 :   compileTime
3 : }

Note: If `o = new mymapping.myOtherCFC()` is called from a .cfm (i.e. not during REST call), then error also shows correct file.

Summary: The issue seems to only occur when a CFC *method* throws a compile time error during a *REST call*.

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

CF-4202597 - per-app mappings don't exist in REST CFCs

Issue: per-app mappings don't exist in REST CFCs

Steps to Reproduce:
1) unzip CF-4202597.zip (attached to ticket)
2) run index.cfm to register REST app
3) run mypage.cfm

Actual Result: coldfusion.xml.rpc.CFCInvocationException - Could not find the ColdFusion component or interface mymapping.myOtherCFC

Expected Result: "c"

4) In CF Admin, create "mymapping" mapping to unzipped app's directory
5) run mypage.cfm

Actual and Expected Result: "c"

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

Monday, May 21, 2018

CF-4202547 - CF2016 vs Aether wrt custom REST response via cfthrow

Issue: CF2016 vs Aether wrt custom REST response via cfthrow

History: Pre-Aether, cfthrow could be used to send a custom REST response as JSON. In Aether, this fails (returns HTML of error handler page).

Steps to Reproduce:
1) Unzip CF-4202547.zip (attached to ticket)
2) Run index.cfm to register the REST application
3) Run mypage.cfm and compare the output w/ the code comments in mypage.cfm

Actual Result: CF sends cfthrow's custom message as HTML of error handler page

Expected Result: CF sends cfthrow's custom message as JSON

Related URL: Getting Started with RESTful Web Services in ColdFusion

Verified in build 2018.0.01.308605 (PreRelease).
Filed as CF-4202547.
Summary:

Initially:
1) In non-void UDF, restSetResponse() was ignored
2) In void UDF, cfthrow returned custom REST response as HTML of error handler page (instead of JSON)

Both were filed as CF-3546046, but only #2 was fixed (which I've verified in CF2016 Update 1).

#1 was re-filed as CF-4198298.

In Aether Public Beta Update 1, #1 is fixed but #2's fix was reverted/undone/unfixed.

Filed CF-4202547 to re-fix #2.

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.

CF-4202541 - cfml comment breaks optional semicolon

Issue: cfml comment breaks optional semicolon

Steps to Reproduce:
1) Run:

<cfscript>
  f = function(){var foo="bar"}
</cfscript>

<!---<cfscript>
  a = "b"
</cfscript>--->

Actual Result: Random exception dependent upon the contents of the CFML comment

Expected Result: no output

2) Remove the blank line between the cfscript pairs, or add a semicolon after the code within the 2nd cfscript pair

Actual Result: "--->"

Expected Result: no output

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

Sunday, May 20, 2018

CF-4202540 - standard attribute notation doesn't override JavaDoc notation

Issue: standard attribute notation doesn't override JavaDoc notation

Note: The "Defining components and functions in CFScript" doc says "Attribute values set in the element declaration take precedence over the values set in the comment section. Therefore, if you set an attribute, such as a hint in both locations, ColdFusion ignores the value in the comment section and uses only the one in the element declaration.".

Note: Lucee correctly behaves as per that doc.

Repro:

<cfscript>
  /**
  *@description original description
  *@displayname original displayname
  *@hint original hint
  *@output false
  *@roles original,roles
  */
  public function foo() description="overridden description" displayname="overridden displayname" hint="overridden hint" output=false roles="overridden,roles" {}
  writeDump(foo)
</cfscript>

Actual Result: coldfusion.compiler.DuplicateAttributeException

Expected Result (and actual behavior w/ Lucee):

function foo
Arguments: none
ReturnType: Any
Roles: overridden,roles
Access: public
Output: false
DisplayName: overridden displayname
Hint: overridden hint
Description: overridden description
Related URL: Defining components and functions in CFScript
Verified in build 2018.0.01.308605 (PreRelease).
Filed as CF-4202540.

CF-4202542 - final ignored

Issue: final ignored

Steps to Reproduce:
1) Run:

<cfscript>
  final variables.foo = "final honored"
  variables.foo = "final ignored"
  writeOutput(foo)//if `foo` is changed to `variables.foo`, then coldfusion.compiler.FinalVariableMutationException is thrown
</cfscript>

Actual Result: final ignored

Expected Result: coldfusion.compiler.FinalVariableMutationException on line 3

2) Run:

<cfscript>
  final variables.foo = "final honored"
  variables.foo = "final ignored"
  writeOutput(variables.foo)
  foo = "I call hacks"//if this line is commented-out, then coldfusion.compiler.FinalVariableMutationException is thrown
</cfscript>

Actual Result: final ignored

Expected Result: coldfusion.compiler.FinalVariableMutationException on line 3

3) Run:

<cfscript>
  final variables.foo = "final honored"
  foo = "final ignored"
  writeDump(foo)
</cfscript>

Actual Result: final ignored

Expected Result: coldfusion.compiler.FinalVariableMutationException on line 3

4) Run:

<cfscript>
  function f() {
  final local.foo = "final honored"
  var foo = "final ignored"
  return foo
  }
  writeDump(f())
</cfscript>

Actual Result: final ignored

Expected Result: coldfusion.compiler.FinalVariableMutationException on line 4

5) Run:

<cfscript>
  final variables.foo = "final honored"
  foo = function(){variables.bar="final ignored"}
  foo()
  writeOutput(isClosure(foo) & ' ' & bar)
</cfscript>

Actual Result: YES final ignored

Expected Result: coldfusion.compiler.FinalVariableMutationException on line 3

6) Run:

<cfscript>
  final variables.foo = "bar"
  function foo() {}//this line is completely ignored
  writeDump(foo)
</cfscript>

Actual Result: bar

Expected Result: coldfusion.compiler.FinalVariableMutationException on line 3

7) Run:

<cfscript>
  final cfthread="bar"
  cfthread(name="myThread"){}
  //thread name="myThread" {}//same issue
  thread action="join" name="myThread";
  writeDump(cfthread)
</cfscript>

Actual Result: bar

Expected Result: coldfusion.compiler.FinalVariableMutationException on line 3

8) Run:

mycustomtag.cfm

<cfscript>
  if(THISTAG.executionMode == "start") {
  final CALLER.foo = "final honored"
  }
</cfscript>

index.cfm

<cfscript>
  cfmodule(template="mycustomtag.cfm")
  foo = "final ignored"
  writeOutput(foo)
</cfscript>

Actual Result: final ignored

Expected Result: coldfusion.compiler.FinalVariableMutationException on index.cfm line 3

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

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