View previous topic :: View next topic |
Author |
Message |
slamer3000 Smarty Rookie
Joined: 19 Dec 2008 Posts: 6 Location: Ukraine
|
Posted: Tue May 26, 2009 2:54 pm Post subject: Smarty 2.6.25 issues |
|
|
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 |
|
slamer3000 Smarty Rookie
Joined: 19 Dec 2008 Posts: 6 Location: Ukraine
|
Posted: Tue May 26, 2009 3:08 pm Post subject: |
|
|
And than after Smarty 2.6.21 you releasing only bugs in the product.
That's my opinion. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue May 26, 2009 5:45 pm Post subject: |
|
|
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 |
|
slamer3000 Smarty Rookie
Joined: 19 Dec 2008 Posts: 6 Location: Ukraine
|
Posted: Thu May 28, 2009 7:05 am Post subject: |
|
|
Yes, I see...
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.... |
|
Back to top |
|
luke_a Smarty Rookie
Joined: 12 May 2009 Posts: 6
|
Posted: Thu May 28, 2009 1:12 pm Post subject: |
|
|
@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 |
|
slamer3000 Smarty Rookie
Joined: 19 Dec 2008 Posts: 6 Location: Ukraine
|
Posted: Wed Jun 03, 2009 6:23 am Post subject: |
|
|
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 |
|
ToySoldier Smarty n00b
Joined: 14 Jun 2009 Posts: 4
|
Posted: Sun Jun 14, 2009 9:29 pm Post subject: |
|
|
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 |
|
|