Re: static members of internal classes

From: Date: Thu, 21 Jul 2005 19:25:23 +0000
Subject: Re: static members of internal classes
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-17368@lists.php.net to get a copy of this message
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 >

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.internals (#17368) next »