Re: Re[4]: Re[2]: mixing of asign() and assign_by_ref() overwrites external vars

boots <[email protected]>
Newsgroups gmane.comp.php.smarty.devel
Message-ID <[email protected]>
--- Dmitry Koteroff <[email protected]> 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/ 

-- 
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.