Re: RE: PHP 4.0 Bug #6193 Updated: new object makes a shallow copy

From: Date: Fri, 18 Aug 2000 21:28:00 +0000
Subject: Re: RE: PHP 4.0 Bug #6193 Updated: new object makes a shallow copy
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-29545@lists.php.net to get a copy of this message
You should think of "$a =& $b;" as "make the symbol table entry $a reference the same PHP value bucket as $b. If the $a symbol table entry was in use before it just changes it to point at the same PHP value bucket as $b. It is a symbol table re-assign. Look at the following example: function foo(&$a) {
        $b = 4;
        $a =& $b;
} foo($blah); In the beginning of the function $a is a local variable within foo() which points at the calling functions variable $blah. After the line "$a =& $b;" $a is re-assigned to point at $b, and therefore, disconnected from $blah. Andi At 11:10 PM 8/18/00 +0200, André Langhorst wrote:
PHP-DEV-POV:
They are not "double". They mean different things. This could be improved by adding some more logic into the compiler, and maybe will be. But it has nothing to do with compiler design.
from the mentioned POV they´re double
HD>>    - member(&x) { $x= &$this; } is broken.
HD>>            $x= &give_me_your_this(); // works
HD>>            member_function() { $x= &this; }; // fails
No it isn't a bug. Please read my previous mails.
I´d consider this a *very unexpected behaviour* (PHP-POV) $a=1; function foo(&$b) { $b=2; ... changes $a and $b to 2, why shouldn´t then $a=1; function foo(&$b) { $b=&$c; $a and $b and $c referenced afterwards? it really could need improvement regards --
o----------0-¬---------O-·---¬----o---®-----o o    O   °       .
| http://www.kiffen.de | pRoteçt y0ur bRaín |0  O °     ¤  °        ·
0°·³°²'²³-¹'³´³°^°³~³²³°'³²²¨³²^³¹³²°²³`³º³°Þ ° o © ° . ·
| psychedelic experience |  gott@kiffen.de  | O   ° o           °
o-¬--o--0-----©-·--O-----o-----0-¤----------o 0 ° · ° . ¤ · -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.dev (#29545) next »