Re: Bug in Smarty Compiler concerning constants?
boots <[email protected]>
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <[email protected]> |
It looks like there is an issue but I believe that Smarty should output quoted text rather than a constant token, not? Especially since constants are accessed from the $smarty reserved variable, ie: $smarty.const.CONSTANT. xo boots --- Oliver Jones <[email protected]> wrote: > Hi Folks. I think I might have found a bug in the smarty compiler. > In a template file I wrote, this code: > > {if $_admin_user->hasRight(UNIT_MANAGEMENT) } > > produces this PHP: > > <?php if ($this->_tpl_vars['_admin_user']->hasRight > ('UNIT_MANAGEMENT')): ?> > > However this template code: > > {if $_admin_user->hasRight( UNIT_MANAGEMENT ) } > > produces: > > <?php if ($this->_tpl_vars['_admin_user']->hasRight > ( UNIT_MANAGEMENT )): ?> > > The latter being correct. UNIT_MANAGEMENT is a constant defined in a > PHP file earlier "required" into the code base. > > Perhaps the Smarty parser needs a little update. > > This behaviour was observed in Smarty 2.6.7. > > For the moment I will just add spaces around my constants when > passing > them to functions in templates. > > Regards > -- > Oliver Jones » Roving Code Warrior > [email protected] » +64 (21) 41 2238 » www.deeperdesign.com -- Smarty Development Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php