Skip to content

loop.last with generator should throw an exception #4096

Description

@Geolim4

Hello,

I painfully discovered that loop.last is indeed impossible to access when your looping over a generator (after a couple of hours of painful debug), but I was wondering if there's any possibility for Twig to instead throw an exception when people are accessing to loop.last which is currently "undefined" (obviously) to make the error clearer about WHY is loop.last undefined :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions