Hi,
I am writing my own PHP Extension called php2ucs to PHP 5.0.
In PHP 4.2.x, we had the following definitions in _zend_class_entry
in zend.h file:
- Method call:
void (*handle_function_call)(INTERNAL_FUNCTION_PARAMETERS,
zend_property_reference *property_reference); - Property Get:
zval (*handle_property_get)(zend_property_reference
*property_reference); - Property Set:
int (*handle_property_set)(zend_property_reference
*property_reference,
zval *value);
In PHP 5.0:
_zend_class_entry in zend.h has the following:
union _zend_function *__get;
union _zend_function *__set;
union _zend_function *__call;
I am doing the below in my extension:
zend_internal_function invoke_method_fe;
zend_internal_function get_property_fe;
zend_internal_function set_property_fe;
static void php2ucs_class_init_func(zend_internal_function *fe,
void (*handler)(INTERNAL_FUNCTION_PARAMETERS))
{
fe->type = ZEND_INTERNAL_FUNCTION;
fe->handler = handler;
fe->function_name = NULL;
fe->scope = NULL;
fe->fn_flags = 0;
fe->prototype = NULL;
fe->num_args = 2;
fe->arg_info = NULL;
fe->pass_rest_by_reference = 0;
}
PHP_MINIT_FUNCTION(ucs)
{
int i;
php2ucs_class_init_func(&invoke_method_fe, invoke_method);
php2ucs_class_init_func(&get_property_fe, get_property);
php2ucs_class_init_func(&set_property_fe, set_property);
// Register 'class' info and functions for accessing methods and
properties
INIT_OVERLOADED_CLASS_ENTRY(ucs_class_entry,
"ucs",
NULL,
(zend_function *)&invoke_method_fe,
(zend_function *)&get_property_fe,
(zend_function *)&set_property_fe);
zend_register_internal_class(&ucs_class_entry TSRMLS_CC);
}
The zend_internal_function structure (in zend_compile.h) has
void (*handler)(INTERNAL_FUNCTION_PARAMETERS); as an element.
This makes it mandatory that all the above three functions
(invoke_method,
get_property and set_property) have the same signature which is
INTERNAL_FUNCTION_PARAMETERS.
My question is, how do I get the zend_property_reference and zval
from this like we had in PHP 4.2.3? Or is it that there is another
approach
in PHP 5.0 without using them? It will really help me if you could let
me
know how to do this or point me to a documentation or a FAQ on this.
Thanks,
Ananth.
This was changed in PHP 5. Take a look at one of the new PHP 5
OO extensions; sqlite, com_dotnet, mysqli etc. for more hints.
There is no documentation yet.
--Wez.
----- Original Message -----
From: "Ananth Kesari" hyanantha@novell.com
To: internals@lists.php.net
Sent: Thursday, April 08, 2004 4:05 PM
Subject: [PHP-DEV] Writing my own Extension to PHP 5.0
The zend_internal_function structure (in zend_compile.h) has
void (*handler)(INTERNAL_FUNCTION_PARAMETERS); as an element.
This makes it mandatory that all the above three functions
(invoke_method,
get_property and set_property) have the same signature which is
INTERNAL_FUNCTION_PARAMETERS.My question is, how do I get the zend_property_reference and zval
from this like we had in PHP 4.2.3? Or is it that there is another
approach
in PHP 5.0 without using them? It will really help me if you could let
me
know how to do this or point me to a documentation or a FAQ on this.