ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

parse_globals() do not parse 'external' global vars

April 17, 2012 4:28am

Subscribe [2]
  • #1 / Apr 17, 2012 4:28am

    Pv Ledoux

    95 posts

    Hi,

    I have noticed an annoying problem since we upgraded to 2.4.

    We use a series of configuration global variables for our sites (ie: language_code, current_language, video_169_width, video_169_height, etc). As we are lazy/organized, we have placed all that kind of ‘external’ global vars in the index.php in the $assign_to_config[‘global_vars’] array.

    That was working great until the upgrade to 2.4. Those variables are only parsed in the template, but not in a plugin tag (for instance). So if I call {language_code} in the template, no problem, it is outputted, but if I call {exp:channel:entries search:video_langage="{language_code}”} it is not working anymore.

    I first noticed the problem with one of my plugin. So I digged a bit and noticed that the method parse_globals() of Template class is not parsing those global vars at all.

    Before the upgrade, to output the result of my plugin, I was doing something like:

    $this->return_data = $this->_ee->TMPL->parse_variables($this->_ee->TMPL->tagdata, $this->_fetch())

    and the ‘external’ global vars was parsed. Now, I have to do that:

    $result = $this->_ee->TMPL->parse_variables($this->_ee->TMPL->tagdata, $this->_fetch());
    $this->return_data = $this->_ee->TMPL->parse_variables($result, array($this->_ee->config->_global_vars));

    I hate patching the code that way but it was the only quick way I found.

    So (finally 😊 ) is it a bug? Is it the normal way to do? What happened?

    Thanks in advance for you time!


    Cheers,

    Pv

  • #2 / Apr 18, 2012 9:45am

    Dan Decker

    7338 posts

    Hi Pv Ledoux,

    I don’t imagine what you are experiencing it the intended behavior. Thanks for digging up the clue!

    Since your findings are related to Development and Programming, I request that you file this in a Bug Report. If you file the report, you will be automatically subscribed to the report and be alerted to a fix if one becomes available.

    Is there anything else I can assist you with?

    Cheers,

  • #3 / Apr 18, 2012 11:29am

    Pv Ledoux

    95 posts

    Hi Dan,

    Thanks for your reply. Bug reported here: https://support.ellislab.com/bugs/detail/17801

    Best regards,

    Pv

  • #4 / Apr 19, 2012 3:44pm

    Shane Eckert

    7174 posts

    Hello Pv Ledoux,

    Thank you for reporting the bug.

    If you need anything else, please just let us know by opening a new thread.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases