tracker issue : CF-4204921

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] Bug for: CF2018's support for script arguments named 'default' is incomplete

| View in Tracker

Status/Resolution/Reason: Open//

Reporter/Name(from Bugbase): Aaron N. / ()

Created: 08/04/2019

Components: Language, Functions

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2018,0,04,314546 /

Priority/Frequency: Normal / Few users will encounter

Locale/System: / Platforms All

Vote Count: 0

Issue: CF2018's support for script arguments named 'default' is incomplete. The fix was only applied to the 1st argument, whereas arguments 2+ still exhibit the undocumented CF9 behavior which we agreed during Aether to unsupport.

Steps to Reproduce:

<cfscript>
  function f1(myType1 myName1, myType2 myName2){}
  writeOutput(serializeJSON(f1.getMetadata().parameters[1]) & '<br>')
  writeOutput(serializeJSON(f1.getMetadata().parameters[2]) & '<hr>')
  
  function f2(myType1 myName1 default, myType2 myName2 default){}
  writeOutput(serializeJSON(f2.getMetadata().parameters[1]) & '<br>')
  writeOutput(serializeJSON(f2.getMetadata().parameters[2]) & '<hr>')
  
  function f3(required myType1 myName1, required myType2 myName2){}
  writeOutput(serializeJSON(f3.getMetadata().parameters[1]) & '<br>')
  writeOutput(serializeJSON(f3.getMetadata().parameters[2]) & '<hr>')
  
  function f4(required myType1 myName1 default, required myType2 myName2 default){}
  writeOutput(serializeJSON(f4.getMetadata().parameters[1]) & '<br>')
  writeOutput(serializeJSON(f4.getMetadata().parameters[2]))
</cfscript>

Actual Result:

{"REQUIRED":"false","TYPE":"myType1","NAME":"myName1"}
{"REQUIRED":"false","TYPE":"myType2","NAME":"myName2"}
----
{"REQUIRED":"false","TYPE":"myName1","NAME":"default"}
{"REQUIRED":"false","TYPE":"myType2","DEFAULT":"","NAME":"myName2"}
----
{"REQUIRED":"true","TYPE":"myType1","NAME":"myName1"}
{"REQUIRED":"true","TYPE":"myType2","NAME":"myName2"}
----
{"REQUIRED":"true","TYPE":"myName1","NAME":"default"}
{"REQUIRED":"true","TYPE":"myType2","DEFAULT":"","NAME":"myName2"}

Expected Result:

{"REQUIRED":"false","TYPE":"myType1","NAME":"myName1"}
{"REQUIRED":"false","TYPE":"myType2","NAME":"myName2"}
----
{"REQUIRED":"false","TYPE":"myType1","DEFAULT":"","NAME":"myName1"}
{"REQUIRED":"false","TYPE":"myType2","DEFAULT":"","NAME":"myName2"}
----
{"REQUIRED":"true","TYPE":"myType1","NAME":"myName1"}
{"REQUIRED":"true","TYPE":"myType2","NAME":"myName2"}
----
{"REQUIRED":"true","TYPE":"myType1","DEFAULT":"","NAME":"myName1"}
{"REQUIRED":"true","TYPE":"myType2","DEFAULT":"","NAME":"myName2"}

Attachments:

Comments:

I wish I could update the description. I forgot to include these examples: <cfscript> function f5(myType1 myName1, myType2 myName2){} writeOutput(serializeJSON(f5.getMetadata().parameters[1]) & '<br>') writeOutput(serializeJSON(f5.getMetadata().parameters[2]) & '<hr>') function f6(myType1 default, myType2 default){} writeOutput(serializeJSON(f6.getMetadata().parameters[1]) & '<br>') writeOutput(serializeJSON(f6.getMetadata().parameters[2]) & '<hr>') function f7(required myType1 myName1, required myType2 myName2){} writeOutput(serializeJSON(f7.getMetadata().parameters[1]) & '<br>') writeOutput(serializeJSON(f7.getMetadata().parameters[2]) & '<hr>') function f8(required myType1 default, required myType2 default){} writeOutput(serializeJSON(f8.getMetadata().parameters[1]) & '<br>') writeOutput(serializeJSON(f8.getMetadata().parameters[2])) </cfscript> Actual Result: {"REQUIRED":"false","TYPE":"myType1","NAME":"myName1"} {"REQUIRED":"false","TYPE":"myType2","NAME":"myName2"} ---- {"REQUIRED":"false","TYPE":"myType1","NAME":"default"} {"REQUIRED":"false","DEFAULT":"","NAME":"myType2"} ---- {"REQUIRED":"true","TYPE":"myType1","NAME":"myName1"} {"REQUIRED":"true","TYPE":"myType2","NAME":"myName2"} ---- {"REQUIRED":"true","TYPE":"myType1","NAME":"default"} {"REQUIRED":"true","DEFAULT":"","NAME":"myType2"} Expected Result: {"REQUIRED":"false","TYPE":"myType1","NAME":"myName1"} {"REQUIRED":"false","TYPE":"myType2","NAME":"myName2"} ---- {"REQUIRED":"false","TYPE":"myType1","NAME":"default"} {"REQUIRED":"false","TYPE":"myType2","NAME":"default"} ---- {"REQUIRED":"true","TYPE":"myType1","NAME":"myName1"} {"REQUIRED":"true","TYPE":"myType2","NAME":"myName2"} ---- {"REQUIRED":"true","TYPE":"myType1","NAME":"default"} {"REQUIRED":"true","TYPE":"myType2","NAME":"default"} Thanks!, -Aaron
Comment by Aaron N.
31099 | August 04, 2019 07:30:05 AM GMT
I am experiencing this issue as well. The biggest issue we are experiencing though is not the "default" value per say, but that the compiler thinks the variable name is a type and so at run time an error is thrown stating the type was not input.
Comment by Bryon N.
31104 | August 06, 2019 03:35:49 PM GMT