Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:2158 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51643 invoked from network); 4 Jun 2003 14:26:32 -0000 Received: from unknown (HELO web12803.mail.yahoo.com) (216.136.174.38) by pb1.pair.com with SMTP; 4 Jun 2003 14:26:32 -0000 Message-ID: <20030604142631.9449.qmail@web12803.mail.yahoo.com> Received: from [128.122.155.151] by web12803.mail.yahoo.com via HTTP; Wed, 04 Jun 2003 07:26:31 PDT X-RocketYMMF: zaunere Date: Wed, 4 Jun 2003 07:26:31 -0700 (PDT) Reply-To: hans@nyphp.org To: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Undefined variables as extension args From: hans@nyphp.org (Hans Zaunere) Hello, Please forgive me if this question is redundant, but I've searched high and low to no avail. As a PHP extension, I'm writing a ZEND_FUNCTION(myfunc) that needs to accept two variables from PHP land, fill in two values (longs) and then return TRUE or FALSE. Briefly: ZEND_FUNCTION(ncurses_getyx) { zval *z_y,*z_x; if( ZEND_NUM_ARGS() != 2 ) WRONG_PARAM_COUNT; if( zend_parse_parameters(2 TSRMLS_CC, "zz",&z_y,&z_x) == FAILURE ) RETURN_FALSE; ZVAL_LONG(z_y,123); ZVAL_LONG(z_x,321); RETURN_TRUE; } So, simple enough, this works, called, for example, like so from PHP: $myy = 0; $myx = 0; ncurses_getyx($myy,$myx); However, when I don't initialize $myy and $myx to 0 in PHP, I get "Notice - Undefined variable: " errors. While I understand why it would happen, I'd like my function to act, for instance, like exec(). exec() will accept arguments to fill in, and even if they've never been initialized anywhere, no such notice will be thrown. getmxrr() acts in a similar way. I've looked at the code for both of these functions: http://lxr.php.net/source/php4/ext/standard/exec.c#192 http://lxr.php.net/source/php4/ext/standard/dns.c#708 but cannot see anything significant that would incur such different behavior from that of my function. I've played around with zval_dtor(), which is used in exec(), but still without any luck. Any help is appreciated. Hans