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: signature.asc
Description: OpenPGP digital signature

Reply via email to