Re: Re: zend_call_method

From: Date: Tue, 07 Sep 2010 17:27:38 +0000
Subject: Re: Re: zend_call_method
References: 1 2 3  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-7613@lists.php.net to get a copy of this message
On Tue, 07 Sep 2010 18:18:04 +0100, Nicolas Brousse <nicolas@brousse.info> wrote:
2010/9/7 Johannes Schlüter <johannes@php.net>:
On Tue, 2010-09-07 at 03:40 -0700, Nicolas Brousse wrote:
Fatal error: Class entry requested for an object without PHP class in Unknown on line 0 I'm not sure to understand what does it mean. Any clue ?
+        zval *rv;
+        zend_function *free;
+        zend_hash_find(&intern->std.ce->function_table, "free", sizeof("free"),(void **) &free);
+        zend_call_method_with_0_params((zval **) object, intern->std.ce, &free , "free", &rv);
So where does "object" come from, where is it set? :-)
Sorry, I just copied a small part of a diff. I'm trying to get my object calling the "free" method before being destruct, so I'm calling that inside a zend_objects_store_dtor_t method :
The object store destructor (zend_objects_destroy_object) already does that. It calls the function in ce->destructor. See http://lxr.php.net/opengrok/xref/PHP_5_3/Zend/zend_objects.c#50 So all you have to do is to define the destructor method appropriately (e.g. including the flag ZEND_ACC_DTOR in the appropriate internal method in the enumeration of the methods for an internal class), and use zend_objects_destroy_object as the destructor. If you need to do more stuff, define your own destructor and delegate the rest to zend_objects_destroy_object. -- Gustavo Lopes

« previous php.pecl.dev (#7613) next »