Re: Re[4]: [SMARTY-DEV] Re[2]: mixing of asign() and assign_by_ref() overwrites external vars
| From: | boots | Date: | Fri, 04 Jun 2004 21:23:25 +0000 |
| Subject: | Re: Re[4]: [SMARTY-DEV] Re[2]: mixing of asign() and assign_by_ref() overwrites external vars | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-2400@lists.php.net to get a copy of this message | ||
--- Dmitry Koteroff <delete@koteroff.ru> wrote:
> B> This breaks BC because it changes the way assign works.
> Wrong.
> Seems we do not understand each other again.
Actually, I'm not wrong, I merely picked bad example (see below). But
this shows that what I am trying to demonstrate: you don't seem to be
interested in deep implications, particularly when you are changing
some of the most used and well tested features.
What do you make of this?
-- t.php --
$smarty->force_compile=true;
$a=array("b"=>"b");
$b=array("b"=> &$a["b"]);
$smarty->assign('b', $b); // note, no &
$smarty->display('t.tpl');
-- t.tpl --
B: {$b|@debug_print_var}<br/>
{php}
global $a;
$a["b"] = "c";
{/php}
B: {$b|@debug_print_var}<br/>
-- OUTPUT --
B: Array (1)
b => b
B: Array (1)
b => c
> And, of course, this patch solves the problem in the first letter
> of this thread - re-assigning variable which was previously
> assigned by reference does not modify source:
It doesn't solve the problem: the original poster was mis-using the
feature.
I tire of this now.
xo boots
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/