Details
Assignee
UnassignedUnassignedReporter
Adam CameronAdam CameronPriority
MinorNew Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Details
Details
Assignee
Unassigned
UnassignedReporter
Adam Cameron
Adam CameronPriority
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Created 6 June 2015 at 17:35
Updated 29 September 2023 at 08:15
Repro attached, but also here for easy inspection:
<cfscript> a = ["a", "b", "c"] ; result = arrayFilter(a, function(v,i,a,x){ writeDump(arguments); return true; }); writeDump(result); result = directoryList(expandPath("."), true, "array", function(f,g){ writeDump(arguments); return true; }); writeDump(result); </cfscript>
The first example is a control. Note how my callback function for
arrayFilter()
can have additional arguments that are not expected.However the second example, using
directoryList()
raises an exception because the function I'm using for the callback takes an additional argument.It is in conflict with how CFML's UDFs work to error based solely on the signature of the method. You should not be doing this sort of argumet-count verification. Just let the function run... it'll error all by itself if it so transpires it actually needed that additional argument.
Bear in mind that callbacks are not necessarily defined inline & use-time; it's entirely possible to use an already existing function... one that might have a default on that argument, or it's not used in the situation it'll be used at runtime, or [whatever]. Don't second-guess this sort of thing.