Re: static members of internal classes
| From: | Michael Wallner | Date: | Thu, 21 Jul 2005 14:30:59 +0000 |
| Subject: | Re: static members of internal classes | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-17357@lists.php.net to get a copy of this message | ||
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 >
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc