summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c47
1 files changed, 21 insertions, 26 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 98312b3464..7e440eea1d 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -4049,42 +4049,37 @@ ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object
}
/* }}} */
-ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value) /* {{{ */
+ZEND_API int zend_update_static_property_ex(zend_class_entry *scope, zend_string *name, zval *value) /* {{{ */
{
zval *property;
zend_class_entry *old_scope = EG(fake_scope);
- zend_string *key = zend_string_init(name, name_length, 0);
EG(fake_scope) = scope;
- property = zend_std_get_static_property(scope, key, 0);
+ property = zend_std_get_static_property(scope, name, 0);
EG(fake_scope) = old_scope;
- zend_string_efree(key);
+
if (!property) {
return FAILURE;
- } else {
- if (property != value) {
- if (Z_ISREF_P(property)) {
- zval_dtor(property);
- ZVAL_COPY_VALUE(property, value);
- if (Z_REFCOUNTED_P(value) && Z_REFCOUNT_P(value) > 0) {
- zval_opt_copy_ctor(property);
- }
- } else {
- zval garbage;
+ }
- ZVAL_COPY_VALUE(&garbage, property);
- if (Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
- if (Z_ISREF_P(value)) {
- SEPARATE_ZVAL(value);
- }
- }
- ZVAL_COPY_VALUE(property, value);
- zval_ptr_dtor(&garbage);
- }
- }
- return SUCCESS;
+ if (property != value) {
+ zval garbage;
+ ZVAL_DEREF(property);
+ ZVAL_DEREF(value);
+ ZVAL_COPY_VALUE(&garbage, property);
+ ZVAL_COPY(property, value);
+ zval_ptr_dtor(&garbage);
}
+ return SUCCESS;
+}
+/* }}} */
+
+ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value) /* {{{ */
+{
+ zend_string *key = zend_string_init(name, name_length, 0);
+ int retval = zend_update_static_property_ex(scope, key, value);
+ zend_string_efree(key);
+ return retval;
}
/* }}} */