logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

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

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

--- Sebastian Mendel <lists@xxxxxxxxxxxxxxxxxx> 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




<Prev in Thread] Current Thread [Next in Thread>