Re: 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> The  whole  point  of  assigning-by-reference  is that you are
B> aliasing  the  variable  as opposed to making a copy. When you
B> assign   $test_2   =  $test,  even  though  you  don't  do  it
B> by-reference, you are making a copy of an object that contains
B> references.  When  you alter the reference (even in the copy),
B> you  necessarily  alter  the original var. This is the way PHP
B> works  and  I  don't  think  it  implies any problems with the
B> Smarty semantics.

D> I still don't understand why don't you want to appli little patch
D> which    was   attached   above.   It   is   fully   transparent,
D> back-compatible   and   add   new  feautures  (including  fix  of
D> unsuspected behavour with assign after assign_by_ref).

Hi Dmitry,

My reasons are thus:

1) I don't agree that it is unsuspected; it follows the PHP4 paradigm.

2) I don't agree that it is transparent: messju already pointed out the
problem with deprecated pass-by-reference.

3) I agree with Monte's sentiment: don't fix what isn't broken. In my
last post, I show the standard work-around for getting the behaviour
that was desired in the case originally given. It uses an existing API
call which merely wraps what you would have to do with straight PHP:
use unset().

4) You are overloading the meaning of assign() to allow
pass-by-reference whereas the Smarty API already decided long ago to
break that into a different API call, namely assign_by_ref(). I think
it is more confusing when you have two methods to do ostensibly the
same thing.

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