Re: mixing of asign() and assign_by_ref() overwrites external vars

Sebastian Mendel <[email protected]>
Newsgroups gmane.comp.php.smarty.devel
Message-ID <[email protected]>
Boots schrieb:

> --- Sebastian Mendel <[email protected]> wrote:
> 
>>Boots schrieb:
>>
>>
>>>[...]
>>>It doesn't solve the problem: the original poster was mis-using the
>>>feature.
>>
>>:-(
>>
>>i dont think so!
> 
> [..snip..]
> 
>>$myvar = true;
>>
>>var_dump($myvar);
>>echo '<br />';
> 
> 
>>$test = new Smarty;
>>$test->assign_by_ref('myvar', $myvar);
>>$test_2 = $test;
>>$test_2->assign('myvar', false);
>>
>>var_dump($myvar);
>>echo '<br />';
> 
> 
> I'm suggesting that you don't really want to use assign_by_ref.

i forgot:

also i think it makes no sense to use smarty manipulating vars in this 
way, i think it should be a one-way

extern -> smarty
and not extern <-> smarty !

i think no one will ever use smarty to change a value of a external var 
by doing an assign() !

it also leads to a possible security-leak, so template designer can 
change vars outside of the template! (also in accident!) - yes, i know, 
this is very abstract.

i think the main advantage (and the only thing wanted/used for?) of 
assign_by_ref is that it not need to be copied in to the smarty-object.


-- 
Sebastian Mendel

www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com
www.sf.net/projects/phpdatetime        www.sf.net/projects/phptimesheet

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.