Sunday, May 20, 2018

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.

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