[PHP-DEV] Return values by reference

2002-03-23 Thread Klaus Reimer
Hi, I am still stuck with my extension module. I'm not able to implement a function which returns a reference to an already existing variable. All I want to do is to write a function like this in C: function &return_reference() { global $a; return $a; } The only possibility I fou

[PHP-DEV] Return object by reference

2002-03-16 Thread Klaus Reimer
Hi, I have an array with object references stored in it. Now I want to write a function which returns one of those references. I'm browsing through this array with the zval_hash_*() functions until I have the correct reference in the Variable **data. But how can I return this value by referenc

Re: [PHP-DEV] FREE_ZVAL and/or zval_dtor()

2002-03-12 Thread Klaus Reimer
Hi, On Tuesday 12 March 2002 14:01, Andrey Hristov wrote: > As far as I see FREE_ZVAL is ZEND_FAST_FREE and the latter is not freeing > memory just removes the zval from a list. So it is required to release the > memory before that. Fix me if I'm wrong. FREE_ZVAL calls ZEND_FAST_FREE, that's cor

[PHP-DEV] FREE_ZVAL and/or zval_dtor()

2002-03-12 Thread Klaus Reimer
Hi, I'm not sure if I have understood how to free the memory allocatedof a zval correctly. Because I don't want to create memory leaks, please tell me if I am right or tell me how it is done correctly: If I create a zval with MAKE_STD_ZVAL, I just need to call FREE_ZVAL, because there is no v

[PHP-DEV] Call overridden methods with call_user_function_ex()

2002-03-11 Thread Klaus Reimer
Hi, I have written an simple extension module with two classes. Class A implements the Method dosomething(). Class B is derived from Class A and overrides the method dosomething(). Now I want the overridden method in Class B to call the original method from Class A. How can I do this with cal

[PHP-DEV] Segfault in do_inherit_parent_constructor

2002-03-11 Thread Klaus Reimer
Hi, I am not sure, if this is an error in my code or a PHP error. Whatever, I need help on this. I have created (and attached) a small demonstration extension module, named ctest. This module creates three classes. class1 is the base class, class2 is derived from class1 and class3 is derived

[PHP-DEV] freeing zvals

2002-03-06 Thread Klaus Reimer
Hi, just a simple question. If I am creating zvals like this: zval *zExample; MAKE_STD_ZVAL(zExample); do I have to free this zval manually (With FREE_ZVAL(zExample)) or is this done automatically? Or it is done automatically only if this zval is exported to user space? I ask because I have t

[PHP-DEV] Get object name

2002-03-04 Thread Klaus Reimer
Hi, I need to acces the name of an object in a class method written in C. How can I do this? Example: I have the following PHP code $Test=new CMyClass(); $Test->print_obj_name(); and I have the following print_obj_name()-method written in C: ZEND_NAMED_FUNCTION(cmyclass_print_obj_name)

Re: [PHP-DEV] zend_get_parameters

2002-03-01 Thread Klaus Reimer
Hi, On Saturday 02 March 2002 00:14, Markus Fischer wrote: > It's supposed to be 'zend_class_entry *', so if you haven't > defined calobject_ce in your code as struct directly I think > you should not use the address operator '&' in front of > calobject_ce. My calobject_ce is dir

[PHP-DEV] zend_get_parameters

2002-03-01 Thread Klaus Reimer
Hi, I have a slight problem with zend_get_parameters(). I want to pass an optional object of a specified class to the constructor of another class. I do this in the constructor: zval *Parent; Parent=NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O!",&Parent,&calobject_