Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17368 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79621 invoked by uid 1010); 21 Jul 2005 19:49:10 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 79579 invoked from network); 21 Jul 2005 19:49:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jul 2005 19:49:10 -0000 X-Host-Fingerprint: 212.183.32.30 M2401P030.adsl.highway.telekom.at Received: from ([212.183.32.30:6116] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6227M)) with SMTP id 16/7D-33635-517FFD24 for ; Thu, 21 Jul 2005 15:27:17 -0400 Message-ID: <16.7D.33635.517FFD24@pb1.pair.com> To: internals@lists.php.net Date: Thu, 21 Jul 2005 21:25:23 +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="------------enig5D2B23C62A4686BC29ECF498" X-Posted-By: 212.183.32.30 Subject: Re: static members of internal classes From: mike@php.net (Michael Wallner) --------------enig5D2B23C62A4686BC29ECF498 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi I wrote: > 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. Finally it seems to boil down to property initialization. ZE uses malloc/free for ZEND_INTERNAL_CLASS' properties while the properties contents will most likely be replaced with emalloc()'d addresses. I think the line zend_hash_init(zo->properties, 0, NULL, ZVAL_PTR_DTOR, 0); in the class ctor is pretty common, but for static properties it is zend_hash_init_ex(ce->static_members, 0, NULL, ZVAL_INTERNAL_PTR_DTOR, persistent_hashes, 0); in zend_initialize_class_data(). I'm quite puzzled now, because zend_declare_property() also uses malloc instead of emalloc() for non-static properties. Do I need to omit e[memfunc]() for static properties? Is it even a bug? Do I need to go to bed? Thanks, -- Michael - < mike(@)php.net > --------------enig5D2B23C62A4686BC29ECF498 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) iD8DBQFC3/am2pTtEijQyW0RAnHoAJ9x2HNJMTVLQaqGQIwJjoReE/iJ1ACfWUqD eJ8QEr90OywfoZBzYTymzl8= =waN8 -----END PGP SIGNATURE----- --------------enig5D2B23C62A4686BC29ECF498--