Re: [SMARTY] Re: object calls fail after upgrade to 2.6.4
| From: | Monte Ohrt | Date: | Thu, 09 Sep 2004 16:14:36 +0000 |
| Subject: | Re: [SMARTY] Re: object calls fail after upgrade to 2.6.4 | ||
| References: | 1 2 3 | Groups: | php.smarty.dev php.smarty.general |
| Request: | Send a blank email to php-smarty-dev+get-2551@lists.php.net to get a copy of this message | ||
After a closer look, it seems that nested objects worked unintentionally because Smarty saw the dash "-" in the "->" as a math operator and allowed it to slip through the parser. I tightened up the parsing a bit ("->" is no longer mistaken as a math operator) and now your code correctly fails ;)
The reason objects as parameters to objects was not allowed is because PCRE does not support infinite recursion, and this would certainly not be practical to parse:
{$foo->bar($foo->bar($foo->bar(...)))}
However, since there is code relying on these little discrepancies, I have just committed to CVS the ability to do one level of object nesting. So, this is valid syntax:
{$foo->bar($foo->bar))}
{$foo->bar($foo->bar()))}
{$foo->bar($foo->bar($foo)))}
{$foo->bar($foo->bar($foo,$bar.blah,0))}
However this is NOT permitted:
{$foo->bar($foo->bar($foo->bar)))}
Please test and let me know if there are problems.
Monte
hans wrote:
On Thu, 9 Sep 2004, Monte Ohrt wrote:objects as params to objects has never been supported: {$obj->meth($foo->var))}Hmm, but it worked in 2.6.3, I have a lot of code relying on it. Even this used to work, and doesn't anymore: {$obj->meth($foo->var.bar)} => $this->_tpl_vars['foo']->var['bar'] Also, messju is right, the case where the first argument is a numeric constant is still broken. Hans !DSPAM:414069f8143622566370718!