Bug in Smarty Compiler concerning constants?

[email protected] (Oliver Jones)
Newsgroups php.smarty.dev
Organization Deeper Design Limited
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.