Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9609 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61201 invoked by uid 1010); 29 Apr 2004 07:32:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 61165 invoked from network); 29 Apr 2004 07:32:25 -0000 Received: from unknown (HELO shiva.mind.de) (212.42.230.204) by pb1.pair.com with SMTP; 29 Apr 2004 07:32:25 -0000 Received: from BAUMBART (p508E9F6B.dip.t-dialin.net [80.142.159.107]) by shiva.mind.de (Postfix) with ESMTP id 3A46B97B4F; Thu, 29 Apr 2004 09:32:24 +0200 (CEST) Date: Thu, 29 Apr 2004 09:32:36 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <751421776.20040429093236@marcus-boerger.de> To: Bill Zeller Cc: internals@lists.php.net In-Reply-To: <20040429052850.23111.qmail@pb1.pair.com> References: <20040429052850.23111.qmail@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] call_user_function wrong number of parameters? From: helly@php.net (Marcus Boerger) Hello Bill, Thursday, April 29, 2004, 7:26:49 AM, you wrote: > (Win XP Pro, PHP 5 RC 1, Visual C++ .NET) > Hi, > I'm trying to create an extension which calls a function defined in a PHP > script. The name of this function is "someFunction". > My code is here: > zval **params[2], *func_name, *retval_ptr; It must be zval *params[2] (only one *) And func_name (not *) > CLS_FETCH(); what does it do? I hope it does the following which is needed: fetch a zval into zval params[0] and zval params[1] > ZVAL_STRING(func_name, "someFunction", 1); change that to ZVAL_STRING(&func_name, 'someFunc', 0) (notice & and 0 above) and don't free func_name, that's unneeded overhead after these changes > ZVAL_LONG(*params[0], 32); > ZVAL_STRING(*params[1], "meters", 1); > if (call_user_function(CG(function_table), NULL, func_name,&retval_ptr, here you need &func_name, too > 2,params) == SUCCESS) { > zval_ptr_dtor(&retval_ptr); > } > When I compile this I get an error saying > c:\Documents and Settings\Bill > Zeller\Desktop\testing\phui\phui_ext\phui_ext\phui_ext.cpp(121): error > C2198: 'call_user_function' : too few actual parameters > I don't know why this happens, because I'm using the arguments as described > in the definition on line 298 of zend_API.h: > ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, > zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] > TSRMLS_DC); > Thanks for your help, > Best Regards, > Bill Zeller -- Best regards, Marcus mailto:helly@php.net