I wrote:

> In case of zend_update_static_property(), because one would need
> to replicate the body of that function at each writing access?

Please note that the code I'm currently using has changed from the original 
patch:

int zend_update_static_property(zend_class_entry *scope, char *name, size_t 
name_len, zval *value TSRMLS_DC)
{
        int retval;
        zval **property = NULL;
        zend_class_entry *old_scope = EG(scope);
        
        EG(scope) = scope;
        
        if (!(property = zend_std_get_static_property(scope, name, name_len, 0 
TSRMLS_CC))) {
                retval = FAILURE;
        } else if (*property == value) {
                retval = SUCCESS;
        } else {
                value->refcount++;
                if (PZVAL_IS_REF(*property)) {
                        zval_dtor(*property);
                        (*property)->type = value->type;
                        (*property)->value = value->value;
                        
                        if (value->refcount) {
                                zval_copy_ctor(*property);
                        }
                } else {
                        REPLACE_ZVAL_VALUE(property, value, 1);
                }
                retval = SUCCESS;
        }
        zval_ptr_dtor(&value);
        EG(scope) = old_scope;
        
        return retval;
}

Regards,
-- 
Michael - < mike(@)php.net >

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to