Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13880 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75824 invoked by uid 1010); 17 Nov 2004 07:57:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 75643 invoked from network); 17 Nov 2004 07:57:37 -0000 Received: from unknown (HELO jan.prima.de) (83.97.50.139) by pb1.pair.com with SMTP; 17 Nov 2004 07:57:37 -0000 Received: from BAUMBART (p508EB16D.dip.t-dialin.net [::ffff:80.142.177.109]) (IDENT: HydraIRC, AUTH: LOGIN tobi) by jan.prima.de with esmtp; Wed, 17 Nov 2004 07:55:21 +0000 Date: Wed, 17 Nov 2004 08:58:00 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <123684040.20041117085800@marcus-boerger.de> To: Evan Nemerson CC: internals@lists.php.net In-Reply-To: <200411161435.02851.evan@coeus-group.com> References: <200411161154.45169.evan@coeus-group.com> <1752161643.20041116223255@marcus-boerger.de> <200411161435.02851.evan@coeus-group.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Overloaded class registration From: helly@php.net (Marcus Boerger) Hello Evan, what you do is irrelevant you need to define the method signature. See example from Zend/zend_interfaces.c: static ZEND_BEGIN_ARG_INFO(arginfo_arrayaccess_offset, 0) ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO(); static ZEND_BEGIN_ARG_INFO(arginfo_arrayaccess_offset_value, 0) ZEND_ARG_INFO(0, offset) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO(); zend_function_entry zend_funcs_arrayaccess[] = { ZEND_ABSTRACT_ME(arrayaccess, offsetExists, arginfo_arrayaccess_offset) ZEND_ABSTRACT_ME(arrayaccess, offsetGet, arginfo_arrayaccess_offset) ZEND_ABSTRACT_ME(arrayaccess, offsetSet, arginfo_arrayaccess_offset_value) ZEND_ABSTRACT_ME(arrayaccess, offsetUnset, arginfo_arrayaccess_offset) {NULL, NULL, NULL} }; Tuesday, November 16, 2004, 11:35:24 PM, you wrote: > On Tuesday 16 Nov 2004 13:32, Marcus Boerger wrote: >> Hello Evan, >> >> your implementation is wrong, you need to specify the arguments to >> __get/__set. > Thanks for the reply, but can you be a bit more specific? I'm already > specifying num_args and required_num_args (the former of which is what is > checked in zend_check_magic_method_implementation()). Setting arg_info seems > to have no effect. Here's the code I used to try setting arg_info (apologies > if it wraps) for the __set method: > fe_set.type = ZEND_INTERNAL_FUNCTION; > fe_set.handler = ZEND_FN(fannOO___set); > fe_set.function_name = NULL; > fe_set.scope = NULL; > fe_set.fn_flags = 0; > fe_set.prototype = NULL; > fe_set.num_args = 2; > fe_set.required_num_args = 2; > fe_set.arg_info = ecalloc(fe_set.num_args, sizeof(zend_arg_info)); > fe_set.pass_rest_by_reference = 0; > fe_set.arg_info[0].name = one; > fe_set.arg_info[0].name_len = strlen(one); > fe_set.arg_info[0].class_name = le_fann_name; > fe_set.arg_info[0].class_name_len = strlen(le_fann_name); > fe_set.arg_info[0].allow_null = 0; > fe_set.arg_info[0].pass_by_reference = 0; > fe_set.arg_info[0].return_reference = 0; > fe_set.arg_info[0].required_num_args = fe_set.required_num_args; > fe_set.arg_info[1].name = two; > fe_set.arg_info[1].name_len = strlen(two); > fe_set.arg_info[1].class_name = le_fann_name; > fe_set.arg_info[1].class_name_len = strlen(le_fann_name); > fe_set.arg_info[1].allow_null = 0; > fe_set.arg_info[1].pass_by_reference = 0; > fe_set.arg_info[1].return_reference = 0; > fe_set.arg_info[1].required_num_args = fe_set.required_num_args; >> >> best regards >> marcus >> >> Tuesday, November 16, 2004, 9:01:25 PM, you wrote: >> > Hi everyone, >> > >> > I noticed recently that both of my extensions (Panda and FANN, both in >> > PECL) emit error messages when their __get() and __set() methods are >> > registered. The problem seems to be that fptr.common->num_args is always >> > 0 in zend_check_magic_method_implementation(), regardless of what I set >> > them to prior to registration. >> > >> > The functions still work perfectly, and valgrind doesn't complain. >> > There's just an incredibly annoying error message every time. It's >> > entirely possible (if not probable) that it's my code that's wrong, not >> > ZE2, but I can't for the life of me figure it out. >> > >> > The pertinant portion of the code is based on the SOAP extension. The >> > source code for the fann extension is at >> > >> http://cvs.sourceforge.net/viewcvs.py/*checkout*/fann/fannphp/fann.c?rev= >> >1.13 >> > >> > I tried pecl-dev last week, and the only suggestion I got was using the >> > read_property and write_property callbacks instead of the __get() and >> > __post() methods, but I don't really think that's an option. The thread >> > is at http://marc.theaimsgroup.com/?l=pecl-dev&m=110012046408453&w=2 >> > >> > Thanks. >> > >> > >> > -- >> > Evan Nemerson >> > evan@coeus-group.com >> > http://coeusgroup.com/en >> >> -- >> Best regards, >> Marcus mailto:helly@php.net > -- > Evan Nemerson > evan@coeus-group.com > http://coeusgroup.com/en -- Best regards, Marcus mailto:helly@php.net