Uploaded image for project: 'Lucee Development'
  1. LDEV-1658

arraySort() member function doesn't validate required params correctly

    Details

    • Type: Bug
    • Status: Deployed
    • Priority: New
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2.6.44
    • Labels:
      None
    • Sprint:
      January 2018 Sprint

      Description

      If I sort an array like so and leave out the "sort type" param, I get a useful error message:

      myArr = [];
      arraySort( myArr );
      
      too few attributes in function [arraySort]
      

      But if I do the same thing with the .sort() member function, I get an odd error from inside Java with a message text of "1" which doesn't make sense.

      myArr = [];
      myArr.sort();
      
      1
      

      Here's the stack trace

      lucee.runtime.exp.NativeException: 1
              at lucee.runtime.functions.arrays.ArraySort.invoke(ArraySort.java:106)
              at lucee.runtime.interpreter.ref.func.BIFCall.getValue(BIFCall.java:137)
              at lucee.runtime.type.util.MemberUtil.call(MemberUtil.java:117)
              at lucee.runtime.type.util.ArraySupport.call(ArraySupport.java:339)
              at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:756)
              at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1698)
              at models.baseconfig_cfc$cf.udfCall2(/cfconfig-services/models/BaseConfig.cfc:858)
              at models.baseconfig_cfc$cf.udfCall(/cfconfig-services/models/BaseConfig.cfc)
      ...
      Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
      

        Attachments

          Activity

            People

            • Assignee:
              michaeloffner Michael Offner
              Reporter:
              bdw429s Brad Wood
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: