Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34821 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10322 invoked by uid 1010); 17 Jan 2008 21:30:17 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 10307 invoked from network); 17 Jan 2008 21:30:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jan 2008 21:30:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=tony@daylessday.org; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tony@daylessday.org; sender-id=pass Received-SPF: pass (pb1.pair.com: domain daylessday.org designates 89.208.40.236 as permitted sender) X-PHP-List-Original-Sender: tony@daylessday.org X-Host-Fingerprint: 89.208.40.236 mail.daylessday.org Linux 2.6 Received: from [89.208.40.236] ([89.208.40.236:45360] helo=daylessday.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 05/02-18592-8E8CF874 for ; Thu, 17 Jan 2008 16:30:16 -0500 Received: from [192.168.1.34] (ppp91-77-91-14.pppoe.mtu-net.ru [91.77.91.14]) by daylessday.org (Postfix) with ESMTP id 81FF06401E6; Fri, 18 Jan 2008 00:30:13 +0300 (MSK) Message-ID: <478FC8E4.3050104@daylessday.org> Date: Fri, 18 Jan 2008 00:30:12 +0300 User-Agent: Thunderbird 2.0.0.9 (X11/20071114) MIME-Version: 1.0 To: Michael B Allen CC: internals@lists.php.net References: <78c6bd860801171233p6f652d3bl54559d51963c1300@mail.gmail.com> In-Reply-To: <78c6bd860801171233p6f652d3bl54559d51963c1300@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Referencing constants in extension code From: tony@daylessday.org (Antony Dovgal) On 17.01.2008 23:33, Michael B Allen wrote: > This has worked fine Are you really sure? Does valgrind confirm it? > PHP_FUNCTION(foo_status) > { > zval *r; > char *s = ""; > int slen; > struct foo *foo = NULL; > > if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!|s!", > &r, &s, &slen) == FAILURE) { > RETURN_FALSE; > } > > if (r) > foo = (struct foo *)zend_fetch_resource(&r TSRMLS_CC, > -1, "foo", NULL, 1, le_foo); > > if (ZEND_NUM_ARGS() > 1) { > foo_status(foo) = s; // save the status for possible retrieval later > } I don't know what "foo_status(foo)" is supposed to mean here, but this code was never supposed to work. You have to copy the string if you want to store it. -- Wbr, Antony Dovgal