-
Notifications
You must be signed in to change notification settings - Fork 823
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
API: <% loop %> and <% with %> only ever create one new scope level (fixes #4015) #8148
API: <% loop %> and <% with %> only ever create one new scope level (fixes #4015) #8148
Conversation
I need to merge up fixes for master behat. |
I've merged up a couple fixes for both testsession + behat-extension. Let's see if that gets the tests running properly. |
src/View/SSViewer_Scope.php
Outdated
@@ -192,7 +192,7 @@ public function obj($name, $arguments = [], $cache = false, $cacheName = null) | |||
switch ($name) { | |||
case 'Up': | |||
if ($this->upIndex === null) { | |||
user_error('Up called when we\'re already at the top of the scope', E_USER_ERROR); | |||
throw new \LogicException('Up called when we\'re already at the top of the scope', E_USER_ERROR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should probably remove that E_USER_ERROR
...
d7ceb18
to
f188a6a
Compare
f188a6a
to
1ec0580
Compare
I've merged up all the branches for core modules to master. Let's see if this gets the tests green. |
Tests are green and the code looks ok, but I really need to do some testing and research to check there are no regressions. |
FYI I used this template to test and it appeared to produce much more expected output. <% include SideBar %>
<div class="content-container unit size3of4 lastUnit">
<article>
<h1>$Title</h1>
<div class="content">$Content</div>
<% if $Parent %>
<h2>all siblings</h2>
<% loop Parent.Children %>
<div>Menu: $Title, Up title: $Up.Title</div>
<h3>Nested</h3>
<% loop Parent.Children %>
<div>Menu: $Title, Up title: $Up.Title, Up up title: $Up.Up.Title</div>
<% end_loop %>
<h3>end nested</h3>
<% end_loop %>
<h2>first sibling</h2>
<% loop Parent.Children.Limit(1) %>
<div>Menu: $Title, Up title: $Up.Title</div>
<% end_loop %>
<% end_if %>
</article>
</div> |
The logic goes over my head a little, but the effect seems to have resolved the usability issue. I'm inclined to merge this and hope that the future will be kind. ;) |
Removes up an age-old quirk where every
.
in<% loop $Foo.Bar.Baz %>
would require an extra$Up
to “escape” from. That was actually a feature, but I’m yet to see compelling use-case for it and it keeps causing confusion (see #4015).Yes this will probably cause breakages for people upgrading, but they’re going to be easy ones to fix. I’ve changed the
user_error()
to an exception, because that way it’s at least possible to see the name of the template that’s affected (even if only the “compiled” line number is shown).3.x and 4.x:
After this change: