Skip to content

{path} tag outputs incorrectly if {current_path:url_encode} exists within same template #3543

Closed as not planned

Description

@ignetic

Description of the problem

If {current_path:url_encode} exists within the same template, the path tag incorrectly outputs what is currently created in {current_path:url_encode}

Example:

Template = news/article
{current_path:url_encode} = outputs news%2Farticle
{path='blog/content'} = incorrectly outputs news/article

This may happen when using other variable modifiers on current_path.

Environment Details:

  • ExpressionEngine 7.3.3
  • PHP Version 7.2

Activity

  1. intoeetive commented on Jun 19, 2023

    @intoeetive
    Contributor

    @ignetic are you using Structure on this site as well?

  2. ignetic commented on Jun 19, 2023

    @ignetic
    Author

    @ignetic are you using Structure on this site as well?

    Yes I am. Though the issue still exists on non-structure pages.

  3. intoeetive commented on Jun 19, 2023

    @intoeetive
    Contributor

    I believe this might be related. We're releasing 7.4.3 today with a fix. If you want to give it a try now, here's pre-release (or just make this change)

  4. ignetic commented on Jun 19, 2023

    @ignetic
    Author

    I believe this might be related. We're releasing 7.4.3 today with a fix. If you want to give it a try now, here's pre-release (or just make this change)

    Hmm, the small change on it's own doesn't seem to have fixed it.

  5. intoeetive commented on Jun 19, 2023

    @intoeetive
    Contributor

    Hm, might be something else then :(

    what other extensions do you have? Does it happen if you place JUST these variables in template, or they need to be inside exp:channel:entries or other tag?

  6. ignetic commented on Jun 19, 2023

    @ignetic
    Author

    I have a whole load of extensions on this site. Perhaps I could test this on a more bare bones install.

    it happens with just these variables in a template on their own, example:

    {current_path:url_encode} | {path='blog/content'}

    Also realised this happens with any modifier on current_path e.g. {current_path:encrypt}

  7. intoeetive commented on Jun 19, 2023

    @intoeetive
    Contributor

    I'm not replicating this on clean install, so it's likely related to either some extension or something in your routing / settings.

  8. ignetic commented on Jun 19, 2023

    @ignetic
    Author

    I'm not replicating this on clean install, so it's likely related to either some extension or something in your routing / settings.

    I think so too. Just running through all extensions to narrow it down

  9. ignetic commented on Jun 19, 2023

    @ignetic
    Author

    More precisely, I found this to be the issue when {current_path:url_encode} inside a condition:

    {if segment_1 == 'search'}search{if:else}{current_path:url_encode}{/if}
    
    {path='blog/content'}
    

    ... still looking into which extension may be causing this ...

  10. ignetic commented on Jun 19, 2023

    @ignetic
    Author

    Found it; looks like Url_helper_ext causes the issue. It is only since EE version 7.3.3. Looking deeper into it now

  11. ignetic commented on Jun 19, 2023

    @ignetic
    Author

    It appears that the URL Helper extension overrides certain variables which causes issues with the {path} tag. Specifically, the variable "path" is put into ee()->config->_global_vars which overrides the tag. This is only happening since EE 7.3.3 so something has changed which allows this to happen.

    I'm using the latest version of URL Helper here https://github.com/litzinger/URL-Helper/tree/master.

    URL Helper appears to allow for variable prefixes set within the config which should resolve this issue. Though overall, allowing the path variable/tag to be overridden may cause some issues where think it should be protected from this in some way.

  12. ignetic commented on Jun 19, 2023

    @ignetic
    Author

    The EE 7.3.4 update seems to have fixed the issue now :)

  13. intoeetive commented on Jun 20, 2023

    @intoeetive
    Contributor

    Happy to hear you don't have the issue with new release!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions