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

Smarty 2.6.25 issues

 
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 -> Bugs
View previous topic :: View next topic  
Author Message
slamer3000
Smarty Rookie


Joined: 19 Dec 2008
Posts: 6
Location: Ukraine

PostPosted: Tue May 26, 2009 2:54 pm    Post subject: Smarty 2.6.25 issues Reply with quote

Wrong parsing tags:

Code:
{counter assign='components_total' start=0}
{foreach from=$last_active_toolbar->getComponents()->children item=item key=key}
  {if not $item->getSetting('right')}
    {counter}
  {/if}
{/foreach}


It compiles them to:
Code:
<?php echo smarty_function_counter(array('assign' => 'components_total','start' => 0), $this);?>

<?php $_from = ($this->_tpl_vars['last_active_toolbar'])."->getComponents()->children"; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['item']):
?>
<?php if (! $this->_tpl_vars['item']->getSetting('right')): ?>
<?php echo smarty_function_counter(array(), $this);?>

<?php endif; ?>
<?php endforeach; endif; unset($_from); ?>   


Wrong string is:
Code:
$_from = ($this->_tpl_vars['last_active_toolbar'])."->getComponents()->children";
Back to top
View user's profile Send private message
slamer3000
Smarty Rookie


Joined: 19 Dec 2008
Posts: 6
Location: Ukraine

PostPosted: Tue May 26, 2009 3:08 pm    Post subject: Reply with quote

And than after Smarty 2.6.21 you releasing only bugs in the product.
That's my opinion.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue May 26, 2009 5:45 pm    Post subject: Reply with quote

Smarty 2 does not support method chaining. It was attempted at one point, then backed out due to unforeseen problems. Smarty 3 will handle them just fine.
Back to top
View user's profile Send private message Visit poster's website
slamer3000
Smarty Rookie


Joined: 19 Dec 2008
Posts: 6
Location: Ukraine

PostPosted: Thu May 28, 2009 7:05 am    Post subject: Reply with quote

Yes, I see... Sad
For example:
Works in 2.6.21:
Code:
{assign var='tmp' value=$engine->constant('COMPONENT_TYPE_PICS')}
{foreach from=$last_active_toolbar->getComponents()->children item=item key=key}
  {img src="`$tmp`/`$item->obj->def_component->list->image`"}
{/foreach}


Does not works in 2.6.21:

Code:
{img src="`$engine->constant('COMPONENT_TYPE_PICS')`/`$item->obj->def_component->list->image`"}


Nothing of these fragments doesn't works in Smarty 2.6.25.
It's bugs...only bugs...new versions are bug-add only.... Smile
Back to top
View user's profile Send private message
luke_a
Smarty Rookie


Joined: 12 May 2009
Posts: 6

PostPosted: Thu May 28, 2009 1:12 pm    Post subject: Reply with quote

@slamer3000

Read the changelog to make sure features you are using have not been disabled, you should do this with any software - not just smarty. This feature was added in 2.6.21 and removed in 2.6.22 because of a bug in another piece of software, so it's a bit unfair to slate Smarty for a bug in PCRE.

It's a bit naive of you not to realise that adding features has the potential to introduce bugs, and you don't have to use the bleeding edge version if it does not introduce any features or security fixes that apply to you. Use 2.6.21 if you absolutely must use method chaining, it's still available on the download page.

Quote:
Version 2.6.24 (May 16th, 2009)
-------------------------------
- fix problem introduced with super global changes (mohrt)

Version 2.6.23 (May 13th, 2009)
-------------------------------
- strip backticks from {math} equations (mohrt)
- make PHP super globals read-only from template (mohrt)
- throw error when template exists but not readable (mohrt)

Version 2.6.22 (Dec 17th, 2008)
-------------------------------

- back out method chaining, bug in some versions of PCRE causes errors (mohrt)

Version 2.6.21 (Dec 2nd, 2008)
------------------------------

- fix function injection security hole closed (U.Tews)
- fix pass expiration time at cache_handler_fuc call in core.write_cache_file.php (U.Tews)
- Update of compiler.class.php to allow method chaining for PHP4 and PHP5 (U.Tews)
Back to top
View user's profile Send private message
slamer3000
Smarty Rookie


Joined: 19 Dec 2008
Posts: 6
Location: Ukraine

PostPosted: Wed Jun 03, 2009 6:23 am    Post subject: Reply with quote

I saw the changes, but after version 2.6.21 Smarty became not usable because there is no projects that do not use method chaining (not only mine projects).
Therefore, I say that newer version is bug-add only.
Back to top
View user's profile Send private message
ToySoldier
Smarty n00b


Joined: 14 Jun 2009
Posts: 4

PostPosted: Sun Jun 14, 2009 9:29 pm    Post subject: Reply with quote

This is not really a bug, but something you can evade:

If you have error reporting on E_ALL and display_errors on in your php.ini, a compiled template gives a warning like "date() [function.date] It is not save to blablabla" which can be evaded by using the date_default_timezone_set() and date_default_timezone_get() functions in combination with in_array and an array with all timezones.
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 -> Bugs 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