Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

silence error operator @

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
kowach
Smarty Rookie


Joined: 26 Jan 2011
Posts: 13

PostPosted: Wed Jun 11, 2014 10:20 am    Post subject: silence error operator @ Reply with quote

I noticed that @ operator is used in compiled and cached templates in modifier default and smarty const.

It is advised not to use @. There is some performance gain if isset() is used instead @.

This code
Code:

{$id|default:0}
{$smarty.const.MYCONST}
{$smarty.const.MYCONST|default:0}


Results in this
Code:

<?php echo (($tmp = @$_smarty_tpl->tpl_vars['id']->value===null||$tmp==='' ? 0 : $tmp);?>
<?php echo @constant('MYCONST');?>
<?php echo (($tmp = @@constant('MYCONST'))===null||$tmp==='' ? 0 : $tmp);?>
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP