Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9003 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92836 invoked by uid 1010); 8 Apr 2004 15:05:18 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 92791 invoked from network); 8 Apr 2004 15:05:17 -0000 Received: from unknown (HELO lucius.provo.novell.com) (137.65.81.172) by pb1.pair.com with SMTP; 8 Apr 2004 15:05:17 -0000 Received: from INET-PRV1-MTA by lucius.provo.novell.com with Novell_GroupWise; Thu, 08 Apr 2004 09:05:17 -0600 Message-ID: X-Mailer: Novell GroupWise Internet Agent 6.5.2 Beta Date: Thu, 08 Apr 2004 09:05:04 -0600 To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Writing my own Extension to PHP 5.0 From: hyanantha@novell.com ("Ananth Kesari") 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: 1. Method call: void (*handle_function_call)(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference); 2. Property Get: zval (*handle_property_get)(zend_property_reference *property_reference); 3. 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.