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

Duplicate names in relationship field cause processing error in EE5.2 but not EE5.1.3 #152

Closed
jcogs-design opened this Issue Mar 9, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@jcogs-design
Copy link

jcogs-design commented Mar 9, 2019

Description of the problem
A block of code that has worked without issue in EE5.1.3 fails after upgrade to EE5.2.

The code unpacks information from a relationship field.

Under EE5.1.3 and before the sample code attached worked fine: generating a series of lists of anchor items with a heading before each, based on the content of a series of entries included in a relationship list.

Under EE5.2 the code fails to render output - instead simply returning the correct number of list items but with unformed content ({item_selection:item_selection:title}) in place of text required.

Conjecture that the issue is due to the name of the relationship field being duplicated in the template - a result of both parent and child entries in the main relationship field containing instances of the same field definition (so the same field name appears twice in series when accessing some elements).

Issue identified after routine upgrade of EE from 5.1.3 to EE 5.2.0.

How To Reproduce
Steps to reproduce the behavior:
Have not yet developed a generic process to reproduce, but would appear to be simply enough to setup a situation where a relationship field recurses. See sample code appended. The error relates to the failure to process the code within the tag pair {item_selection:item_selection} ... {/item_selection:item_selection}

Error Messages
No error message, just unformed tags appearing in template output.

Screenshots / Videos / Template Code

{item_selection}
    {if item_selection:channel_short_name != 'collections'}<a href="/info/{item_selection:url_title}" class="junk">{item_selection:title}</a>{/if}
        {item_selection:item_selection}
            {if item_selection:item_selection:count == 1}<div class="subhead d-flex">{item_selection:title}</div>{/if}
            {if item_selection:item_selection:url_title == "member-login-registration" || item_selection:item_selection:url_title == "logout"}
                {if  item_selection:item_selection:url_title == "member-login-registration" && logged_out}<a href="/info/{item_selection:item_selection:url_title}">{item_selection:item_selection:title}</a>
                {if:elseif item_selection:item_selection:url_title == "logout" && logged_in}
                        <a href="{path='club'}">Member Area</a>
                        <a href="{path='logout'}">Logout</a>
                {/if}
            {if:else}
                <a href="/info/{item_selection:item_selection:url_title}"> {item_selection:item_selection:title}</a>
            {/if}
    {/item_selection:item_selection}
{/item_selection}

Environment Details:

  • Version: 5.2.0
  • PHP Version 7.1
  • MySQL Version 5.7.16
  • OS: Linux
  • Web Server: Apache

Possible Solution
Have reverted the site to EE 5.1.3 until workaround or fix identified. One solution I think would be to create a duplicate relationship field with a different name and use alternative named field in one of the two instances - but would appear some change between EE 5.1.3 and EE 5.2.0 has triggered this anomalous behaviour, and a better fix would be to understand why and revert the change.

Additional context
Will post additional information on solutions when I get a chance to set up site on a test server.

@kevincupp

This comment has been minimized.

Copy link
Contributor

kevincupp commented Mar 11, 2019

Sorry for the trouble, it was probably caused by this: a291390

I'm going to revert that change and fix the original issue it was trying to fix another way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.