Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17357 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15233 invoked by uid 1010); 21 Jul 2005 14:32:56 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 15213 invoked from network); 21 Jul 2005 14:32:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jul 2005 14:32:56 -0000 X-Host-Fingerprint: 212.183.41.141 M2477P013.adsl.highway.telekom.at Received: from ([212.183.41.141:6860] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6227M)) with SMTP id B0/C9-33635-812BFD24 for ; Thu, 21 Jul 2005 10:32:56 -0400 Message-ID: To: internals@lists.php.net Date: Thu, 21 Jul 2005 16:30:59 +0200 Organization: IWORKS User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040803 [ http://iworks.at ] X-Accept-Language: de-AT, de-DE, de, en, en-GB, en-US MIME-Version: 1.0 References: In-Reply-To: X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigDB35BA1E073C3E044303BE4B" X-Posted-By: 212.183.41.141 Subject: Re: static members of internal classes From: mike@php.net (Michael Wallner) --------------enigDB35BA1E073C3E044303BE4B Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I wrote: > I have some issues with static members of internal classes. > AFAICS no extension uses them so far (did I miss something?). I cannot declare static properties as strings because that causes memory errors in zval_dtor() (SET_STATIC_PROP_EX code is actually the same as in ReflectionClass::setStaticPropertyValue), further the strings duplicated by zval_copy_ctor() leak once. Any advice? # define GET_STATIC_PROP_EX(ce, n) zend_std_get_static_property(ce, (#n), sizeof(#n), 0 TSRMLS_CC) # define SET_STATIC_PROP_EX(ce, n, v) \ { \ int refcount; \ zend_uchar is_ref; \ zval **__static = GET_STATIC_PROP_EX(ce, n); \ \ refcount = (*__static)->refcount; \ is_ref = (*__static)->is_ref; \ zval_dtor(*__static); \ **__static = *(v); \ zval_copy_ctor(*__static); \ (*__static)->refcount = refcount; \ (*__static)->is_ref = is_ref; \ } Thanks, -- Michael - < mike(@)php.net > --------------enigDB35BA1E073C3E044303BE4B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Cygwin) iD8DBQFC37Gl2pTtEijQyW0RAnFoAJ9xXSgk3xxzo0qHPElfKfy0/1rSrwCfU4At wVgcVe2n3QTz62mV7roN/lI= =q/OT -----END PGP SIGNATURE----- --------------enigDB35BA1E073C3E044303BE4B--