Velocity
  1. Velocity
  2. VELOCITY-762

$foreach.first and $foreach.last do not have assigned values

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7-beta1
    • Fix Version/s: 1.7, 2.x
    • Component/s: Engine
    • Labels:
      None

      Description

      $foreach.first and $foreach.last are not getting assigned in a loop (while isFirst() and isLast() do) .

      Test case:
      #foreach($i in [1..3])
      index = $foreach.index,
      count = $foreach.count,
      first = $foreach.isFirst() / $foreach.first,
      last = $foreach.isLast() / $foreach.last<br/>
      #end

      Result:
      index = 0, count = 1, first = true / $foreach.first, last = false / $foreach.last
      index = 1, count = 2, first = false / $foreach.first, last = false / $foreach.last
      index = 2, count = 3, first = false / $foreach.first, last = false / $foreach.last

        Activity

        Sergiy Kovalchuk created issue -
        Nathan Bubna made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.7 [ 12313453 ]
        Fix Version/s 2.0 [ 12310291 ]
        Resolution Fixed [ 1 ]
        Hide
        Michael Osipov added a comment -

        I'd like to remark that the last last value is incorrect. More over as you can see in my ticket VELOCITY-772 hasNext is always true, which is oncorrect. That's why isLast() fails.

        Show
        Michael Osipov added a comment - I'd like to remark that the last last value is incorrect. More over as you can see in my ticket VELOCITY-772 hasNext is always true, which is oncorrect. That's why isLast() fails.
        Hide
        Nathan Bubna added a comment -

        Yes, that too was noticed and fixed.

        Show
        Nathan Bubna added a comment - Yes, that too was noticed and fixed.
        Mark Thomas made changes -
        Workflow jira [ 12511190 ] Default workflow, editable Closed status [ 12551725 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12551725 ] jira [ 12552264 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Sergiy Kovalchuk
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development