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