PerlDancer / Dancer2

Perl Dancer Next Generation (rewrite of Perl Dancer)
http://perldancer.org/
Other
542 stars 274 forks source link

Redirect during rendering template results in subsequent recursion errors #1621

Closed abeverley closed 1 year ago

abeverley commented 3 years ago

I'm just opening this issue as a placeholder for a planned PR.

The issue is that if for some reason a redirect takes place during the render of a Template::Toolkit template, then any subsequent calls to that templating engine result in Failed to render template: file error - recursion into...

This is because the redirect causes a long-jump out of Template::Toolkit and it thinks it never finished the render. This is because the renderer's eval doesn't catch the long-jump: https://metacpan.org/source/ATOOMIC/Template-Toolkit-3.009/lib/Template/Document.pm#L160

I propose adding a guard to ensure this doesn't happen. PR to follow.

SysPete commented 3 years ago

Good catch @abeverley, looking forward to the PR.

abeverley commented 3 years ago

Thanks @SysPete please see #1622. It's as much there for discussion as anything. There is one outstanding problem which I could really do with some help with, as described in the comments in the PR.

cromedome commented 1 year ago

Resolved in #1622. Thanks everyone!