Bug in Smarty Compiler concerning constants?
| From: | Oliver Jones | Date: | Tue, 08 Mar 2005 06:16:38 +0000 |
| Subject: | Bug in Smarty Compiler concerning constants? | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-2651@lists.php.net to get a copy of this message | ||
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
oliver@deeperdesign.com » +64 (21) 41 2238 » www.deeperdesign.com