Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete code for handling current-scope loop in templates #11250

Closed
GuySartorelli opened this issue May 17, 2024 · 1 comment
Closed

Incomplete code for handling current-scope loop in templates #11250

GuySartorelli opened this issue May 17, 2024 · 1 comment

Comments

@GuySartorelli
Copy link
Member

GuySartorelli commented May 17, 2024

Found while working on #11237

If you create a <% loop %> tag inside a template without including an argument (i.e. not <% loop $MyIterable %>), the template is generated with some very clearly incomplete code, which includes the placeholder "Foo".

Template:

<% loop %>
    // Inside the loop here
<% end_loop %>

Cached template (what actually gets executed):

$scope->obj('Up', null)->obj('Foo', null);
$scope->pushScope();
while (($key = $scope->next()) !== false) {
$val .= '    // Inside the loop here';
};
$scope->popScope();

This is handled by SSTemplateParser::ClosedBlock_Handle_Loop()

The relevant code was added in 91f4ba1 as part of #209 and it seems pretty clear the intention was to loop over whatever is currently in scope (basically a shortcut for <% loop $Me %>) but that for whatever reason the feature was never fully implemented.

PRs

@sabina-talipova
Copy link
Contributor

PRs merged. Task is completed. Close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants