--- Andi Gutmans <[EMAIL PROTECTED]> wrote:
> At 11:14 11/04/2002 -0700, brad lafountain wrote:
> 
> >--- Andrey Hristov <[EMAIL PROTECTED]> wrote:
> > > But dereferncing like this
> > > $foo->bar()->fubar
> >its not
> >$foo->bar()->fubar
> >its
> >$foo->bar->fubar
> >
> >4.1.2 can't derefrence objects from functions
> >that IS a feature of Z2.. but my example isn't
> >derefrencing something from a function just
> >a member of an object.
> 
> Brad,
> 
> I don't have time right now to study your example but you are most likely 
> stumbling on one of the problems which are supposed to be solved in Engine 
> 2. Actually it is the main driving force for Engine 2 which has java-like 
> object handles and not objects as language primitives which some problems 
> especially additional copying of objects. Try and always treat your object 
> by-reference and it'll probably work.
> 
> Andi


I really don't think that is the problem...

Im pretty sure i know exactly whats going on.. if you look at the zend_execute
it automatically adds a is_ref = 1; and a ref_count++; for all method calls(
the comment next to this line says /* for $this ref */.. this works normally
just becuase a normal method call is a IS_TMP_VAR.. but in the case of a
object's member it is a IS_VAR.. so the ref_count and is_ref gets kept right
along with the instance of the object.. so when you try and copy it with
 $a_copy = $a;
the ref gets copyed along with it so changing anything in 
$a_copy->some_object_you_have_called_a_method_on; the change will be reflected
in $a and $a_copy.


This is defintly a BUG in engine1 and i think it should be addressed. 

this bug only happens when you invoke a method from a instance of an objects
member that is an object.

 I looked thru the bugs and found a simmlar bug...


- Brad..




__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to