Uploaded image for project: 'Railo'
  1. Railo
  2. RAILO-2070

arrayReverse() should update the array inline like other array functions

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Out of Date
    • Affects Version/s: 4.0.0.013
    • Fix Version/s: None
    • Labels:
      None
    • Steps to Reproduce:
      Hide
      <!--- I would expect this to work, but it does not --->
      <cfprocessingdirective pageencoding="utf-8">
      <cfscript>
      daysOfWeek = array("Rāhina", "Rātū", "Rāapa", "Rāpare", "Rāmere", "Rāhoroi", "Rātapu");
      
      daysOfWeek.reverse();
      writeDump(var=daysOfWeek);
      </cfscript>
      
      // one needs to do this
      reversedArray = daysOfWeek.reverse();
      
      Show
      <!--- I would expect this to work, but it does not ---> <cfprocessingdirective pageencoding= "utf-8" > <cfscript> daysOfWeek = array( "Rāhina" , "Rātū" , "Rāapa" , "Rāpare" , "Rāmere" , "Rāhoroi" , "Rātapu" ); daysOfWeek.reverse(); writeDump( var =daysOfWeek); </cfscript> // one needs to do this reversedArray = daysOfWeek.reverse();

      Description

      I fell into a trap here. I presumed this function works like other array functions tend to, and reverses the array inline, rather than returning a different array. IE, this is the code I initially tried:

      [see steps to reproduce]

      Given the way pretty much all other array functions work, I think this discrepancy might count as a bug?

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                micstriit Michael Offner
                Reporter:
                adamcameroncf Adam Cameron
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: