On Fri, Jan 02, 2004 at 04:09:21PM -0800, Andrei Zmievski wrote:

> > Why is my object being treated as a reference while the native PHP
> > object is not?
> 
> I guess that is a question for you really: are you doing anything
> special to make your object a reference? I've used the new object model
> for PHP-GTK and my objects were not treated as references.
 
It appears to be a side-effect of not defining the 'scope' field in
the zend_internal_function call that is invokved from my custom
'constructor_get' handler.  If the 'scope' field is NULL, my object
is treated as a reference.  If I assign my class entry to the 'scope'
field, the object is "normal" (i.e. not a reference).
 
> > 'variable_ptr->refcount=1;' resets the reference count of the
> > variable's zval to 1, but the underlying _store_object's reference
> > count is still incremented.  What will ever reclaim that reference on
> > the _store_object?
> 
> zval_dtor() will. It calls del_ref on the underlying object.

I see.  I would have to call zval_dtor() myself in any of the cases
where I knowingly created an additional reference.  That makes sense.

-- 
Jon Parise ([EMAIL PROTECTED]) :: The PHP Project (http://www.php.net/)

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

Reply via email to