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

Looped tag "merges" entries when referencing assets within #889

wojtiku opened this Issue Aug 25, 2016 · 3 comments


None yet
3 participants

wojtiku commented Aug 25, 2016

Steps to reproduce

  1. You have a file with the following yaml
    avatar: d7ba72ab-ff53-4bda-8661-ecf06f3f439d
    heading: General contact
        number: +12 345 678 901
        number: +12 345 678 902
    address: |
      Street name
      12345 City
    avatar: 78bdfb60-2f5c-4ded-83a1-042f63049fcc
    heading: Product support
    other: |
      Support on duty
      Monday to Friday
      from 8 AM till 4 PM CET

and a template printing it

{{ contacts }}
                <dt>{{ heading }}</dt>
                    {{ asset:avatar }}
                        <img src="{{ url }}" alt="{{ heading }}"/>
                    {{ /asset:avatar }}
                {{ if mail }}
                <dd><a href="mailto:{{ mail }}">{{ mail }}</a></dd>
                {{ /if }}
                {{ if phones }}
                    {{ phones | join }}
                {{ /if }}
                {{ if address }}
                    {{ address | nl2br }}
                {{ /if }}
                {{ if other }}
                    {{ other | nl2br }}
                {{ /if }}
    {{ /contacts }}
  1. Visit the page and the bug occurs - product support contact has phone and address visible even though it shouldn't. I also tried the glide tag and the same bug occurs so this is no the problem with asset tag directly but with referencing assets in general
  2. Remove the asset tag from the template
  3. Visit the page and the bug is not present anymore

Expected behaviour

Each loop execution should have only own fields

Actual behaviour

Each loop execution merges stuff in from the previous ones

Server configuration

Operating system:
Web server:
PHP version:
Statamic version:
2.1.3, this started happening after the upgrade I think
Updated from an older Statamic or fresh install:
Updated but I also checked on a clean install
List of installed addons:


This comment has been minimized.


jasonvarga commented Aug 25, 2016

{{ contacts scope="contact" }}
  {{ contact:phone }} etc
{{ /contacts }}

This comment has been minimized.

wojtiku commented Aug 25, 2016

Thanks for helping with this on slack! It resolves my problem!

I still find it unintuitive though. Why would previous iteration influence the next one? I would understand if the page itself had a global field address for example and that would get used - perfectly clear case here. But borrowing data from previous iteration seems weird - especially that as I demonstrated it only happens when using assets.


This comment has been minimized.

andypillip commented Sep 5, 2016

This is terrible!

One needs to check the templates thoroughly for this case, otherwise contents end up in the wrong places, breaking the site from a content point of view.

Additionally it's not possible to scope inside scopes, e.g.

{{ contacts scope="contact" }}
  {{ contact:phones scope="phone" }}
  {{ phone:number }}
  {{ /contact:phones }}
{{ /contacts }}

would not work, which is totally necessary if you don't want to prefix all your fieldnames with the fieldset.

This makes it impossible to fix in cases where you need to iterate a second time!

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