Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23705 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92870 invoked by uid 1010); 26 May 2006 22:15:01 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 92855 invoked from network); 26 May 2006 22:15:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 May 2006 22:15:01 -0000 X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:35896] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id B6/05-17316-5ED77744 for ; Fri, 26 May 2006 18:15:01 -0400 Received: from baumbart.mbo (dslb-084-063-047-180.pools.arcor-ip.net [84.63.47.180]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id 774EC35C1EB; Sat, 27 May 2006 00:14:58 +0200 (CEST) Date: Sat, 27 May 2006 00:13:09 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <789922954.20060527001309@marcus-boerger.de> To: "D. Dante Lorenso" Cc: PHPdev In-Reply-To: <447768DF.1000203@vocalspace.com> References: <447768DF.1000203@vocalspace.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] extension can not receive unset values without E_NOTICE or reference creation From: helly@php.net (Marcus Boerger) Hello D., you are looking for ZEND_BEGIN_ARG_INFO_EX(), the names of the macro parameters are self speaking. best regards marcus Friday, May 26, 2006, 10:45:19 PM, you wrote: > All, > Back on the topic of trying to write a 'filled' function in an > extension, I have run into trouble. I have declared a function as follows: > ---------- 8< -------------------- 8< ---------- > static > ZEND_BEGIN_ARG_INFO(all_args_prefer_ref, ZEND_SEND_PREFER_REF) > ZEND_END_ARG_INFO() > zend_function_entry shorthand_functions[] = { > PHP_FE(filled, all_args_prefer_ref) > {NULL, NULL, NULL} /* Must be the last line in > shorthand_functions[] */ > }; > PHP_FUNCTION(filled) > { > RETURN_TRUE; > } > ---------- 8< -------------------- 8< ---------- > Then, in PHP I try the following test code: > ---------- 8< -------------------- 8< ---------- > $x = array(); > $x["dog"] = "spot"; > $x["cat"] = "moriss"; > print_r($x); > // testing > print filled("testing", $x["pig"], $y->testing); > print "\n"; > print_r($x); > print_r($y); ?>> > ---------- 8< -------------------- 8< ---------- > Unfortunately, $x now contains a 'pig' key and the non-existent $y has > been transformed into an object: > ---------- 8< -------------------- 8< ---------- > Array > ( > [dog] => spot > [cat] => moriss > ) > 1 > Array > ( > [dog] => spot > [cat] => moriss > [pig] => > ) > stdClass Object > ( > [testing] => > ) > ---------- 8< -------------------- 8< ---------- > Is there a way to define the parameters which an extension's function > will accept to be optionally set? The prefer-by-ref I am using is > making the var exist even when I don't want it to. > Dante Best regards, Marcus