tracker issue : CF-4202293

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

[ANeff] Bug for: invalid UDF argument types should not be allowed

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Aaron Neff / ()

Created: 05/04/2018

Components: Language, Functions

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2018.0.01.308605 (PreRelease) / 2020.0.0.314698

Priority/Frequency: Normal / Few users will encounter

Locale/System: / Windows 10 64 bit

Vote Count: 0

Issue: invalid UDF argument types should not be allowed

Repro:

<cfscript>
  datetime function f1(myArg) {return ARGUMENTS.myArg;}
  writeDump(f1(createDateTime(2018,1,2,3,4,5)));
  //Actual and Expected Result: "coldfusion.runtime.UDFMethod$InvalidReturnTypeException: The value returned from the f1 function is not of type datetime."
  
  function f2(datetime myArg) {return ARGUMENTS.myArg;}
  writeDump(f2(createDateTime(2018,1,2,3,4,5)));
  //Actual and Expected Result: "coldfusion.runtime.UDFMethod$InvalidArgumentTypeException: The MYARG argument passed to the f2 function is not of type datetime."
  
  time function f3(myArg) {return ARGUMENTS.myArg;}
  writeDump(f3(createTime(3,4,5)));
  //Actual and Expected Result: "coldfusion.runtime.UDFMethod$InvalidReturnTypeException: The value returned from the f3 function is not of type time."
  
  function f4(time myArg) {return ARGUMENTS.myArg;}
  writeDump(f4(createTime(3,4,5)));
  //Actual Result: {ts '1899-12-30 03:04:05'}
  //Expected Result: "coldfusion.runtime.UDFMethod$InvalidArgumentTypeException: The MYARG argument passed to the f4 function is not of type time."
</cfscript>

'time' & 'datetime' are not valid UDF argument and return types. Therefore, 'time' should trigger an exception when used as a UDF argument type. Thus, the f4() example should throw an InvalidArgumentTypeException.

Attachments:

Comments:

Related thread: https://forums.adobeprerelease.com/coldfusionpr/discussion/378/cf-4202293-invalid-udf-argument-types-should-not-be-allowed
Comment by Aaron N.
27661 | May 04, 2018 10:19:20 PM GMT
Related tickets: CF-4202192 and CF-4202294
Comment by Aaron N.
27662 | May 04, 2018 11:15:23 PM GMT