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

{$a->b()->c()} doesn't parse (has fix)

 
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 -> Feature Requests
View previous topic :: View next topic  
Author Message
pvginkel
Smarty n00b


Joined: 04 Aug 2006
Posts: 3

PostPosted: Fri Aug 04, 2006 3:36 pm    Post subject: {$a->b()->c()} doesn't parse (has fix) Reply with quote

I'm not sure if this is a bug or a feature request because a compile error is generated on the first code block. The second block does compile though but gives an unexpected result. It should either be fixed or generate a compile error too.

This doesn't compile:

Code:
{$a->b()->c()}


I've found this in a foreach like this, which does compile, but incorrectly:

Code:
{foreach from=$a->b()->c() item="item"}
  {$item}
{/foreach}


This generates the following compiled code for the $a->b()->c() part:

Code:
($this->_tpl_vars['a'])."->b()->c()"


This can be fixed by moving the following code block from Smarty_Compiler.class.php:164 to line 163, directly before the )+) part:

Code:
(?:' . $this->_obj_params_regexp . ')?


With this change, both the first and second code blocks compile and generate the correct result.
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Aug 04, 2006 6:07 pm    Post subject: Reply with quote

Hi and thanks for posting.

This has been discussed many times and the problem is that this would not work under PHP4. As this is not a bug but rather a feature request, I am moving the thread to that forum.
Back to top
View user's profile Send private message
m-kay
Smarty n00b


Joined: 23 Nov 2006
Posts: 4
Location: The Netherlands

PostPosted: Thu Dec 07, 2006 3:15 pm    Post subject: Reply with quote

Wow, I was looking for this! Thanks!
_________________
I look back and I'm amazed, that my thoughts were so clear and true, that three words went through my mind endlessly, repeating themselves like a broken record... you're so cool, you're so cool, you're so cool...
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu Dec 07, 2006 3:31 pm    Post subject: Reply with quote

@m-kay's signature: true romance/patricia arquette/1993 ?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
m-kay
Smarty n00b


Joined: 23 Nov 2006
Posts: 4
Location: The Netherlands

PostPosted: Sun Dec 10, 2006 6:41 pm    Post subject: Reply with quote

messju wrote:
@m-kay's signature: true romance/patricia arquette/1993 ?


Yup. Wink
_________________
I look back and I'm amazed, that my thoughts were so clear and true, that three words went through my mind endlessly, repeating themselves like a broken record... you're so cool, you're so cool, you're so cool...
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 -> Feature Requests 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