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

Railo's Array.each() implementation behaves differently than ColdFusion's

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Out of Date
    • Affects Version/s: 4.2.1.003
    • Fix Version/s: None
    • Labels:
      None

      Description

      NB: I'm not saying it's intrinsically a bug because it doesn't follow CF's lead; at the very least the difference needs to be documented.

      Details here: http://cfmlblog.adamcameron.me/2014/08/what-was-that-arrayeach-quiz-all-about.html

      Bottom line: this code behaves differently on Railo from how it does on CF:

      a = ["a"];
      a[3] = "c";
      
      a.each(function(v,i,a){
      	writeOutput("value: #v?:'null'#<br>");
      });
      

      Railo iterates over the elements, CF iterates over the indexes.

      CF's implementation came first, so - unless there's a conscious decision to vary behaviour - I'd say this is a compat bug in Railo.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: