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

{RegObject->prop} always compiles to method access

 
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 3
View previous topic :: View next topic  
Author Message
marsellus
Smarty n00b


Joined: 06 Jun 2013
Posts: 1

PostPosted: Thu Jun 06, 2013 8:59 am    Post subject: {RegObject->prop} always compiles to method access Reply with quote

With smarty2 i've used this excessively:

Code:
{RegObject->property assign='var'}


Now smarty3 always treats this as if it was a method

Code:
{RegObject->property() assign='var'}



compiled template v2:
Code:
$this->assign('var',  $this->_reg_objects['RegObject'][0]->property);


compiled template v3:
Code:
$_smarty_tpl->assign('var',$_smarty_tpl->smarty->registered_objects['RegObject'][0]->property());



while v2 checked if it was a method, in Smarty_Compiler.class.php, with:
Code:
if(method_exists($this->_reg_objects[$object][0], $obj_comp))


v3 does not do this in smarty_internal_compile_private_object_function.php
so i worked around it using
Code:
 if (method_exists($compiler->smarty->registered_objects[$tag][0], $method))



the price question is: was this feature drop intentional? if so, why?
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Jul 27, 2013 9:50 am    Post subject: Reply with quote

This has been now added for Smarty2 BC in the SVN trunk and will later be included in 3.1.15
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 3 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