summaryrefslogtreecommitdiff
path: root/Zend/zend_object_handlers.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_object_handlers.c')
-rw-r--r--Zend/zend_object_handlers.c50
1 files changed, 3 insertions, 47 deletions
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index ad5a55510b..c474fa8662 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -184,7 +184,7 @@ static void zend_std_call_getter(zval *object, zval *member, zval *retval TSRMLS
/* __get handler is called with one argument:
property name
- it should return whether the call was successfull or not
+ it should return whether the call was successful or not
*/
if (Z_REFCOUNTED_P(member)) Z_ADDREF_P(member);
@@ -207,7 +207,7 @@ static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_D
property name
value to be set
- it should return whether the call was successfull or not
+ it should return whether the call was successful or not
*/
zend_call_method_with_2_params(object, ce, &ce->__set, ZEND_SET_FUNC_NAME, &retval, member, value);
@@ -545,51 +545,7 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, v
} else if (EXPECTED(zobj->properties != NULL)) {
if ((variable_ptr = zend_hash_find(zobj->properties, Z_STR_P(member))) != NULL) {
found:
- /* if we already have this value there, we don't actually need to do anything */
- if (EXPECTED(variable_ptr != value)) {
- /* if we are assigning reference, we shouldn't move it, but instead assign variable
- to the same pointer */
- if (Z_ISREF_P(variable_ptr)) {
- zval garbage;
-
- ZVAL_COPY_VALUE(&garbage, Z_REFVAL_P(variable_ptr)); /* old value should be destroyed */
-
- /* To check: can't *variable_ptr be some system variable like error_zval here? */
- if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
- if (EXPECTED(!Z_ISREF_P(value))) {
- Z_ADDREF_P(value);
- } else {
- if (Z_REFCOUNT_P(value) == 1) {
- ZVAL_UNREF(value);
- } else {
- value = Z_REFVAL_P(value);
- }
- if (Z_REFCOUNTED_P(value)) {
- if (UNEXPECTED(Z_REFVAL_P(variable_ptr) == value)) {
- goto exit;
- }
- Z_ADDREF_P(value);
- }
- }
- }
- ZVAL_COPY_VALUE(Z_REFVAL_P(variable_ptr), value);
- zval_ptr_dtor(&garbage);
- } else {
- zval garbage;
-
- ZVAL_COPY_VALUE(&garbage, variable_ptr);
-
- /* if we assign referenced variable, we should separate it */
- ZVAL_COPY_VALUE(variable_ptr, value);
- if (Z_REFCOUNTED_P(variable_ptr)) {
- Z_ADDREF_P(variable_ptr);
- if (Z_ISREF_P(variable_ptr)) {
- SEPARATE_ZVAL(variable_ptr);
- }
- }
- zval_ptr_dtor(&garbage);
- }
- }
+ zend_assign_to_variable(variable_ptr, value, (IS_VAR|IS_TMP_VAR) TSRMLS_CC);
goto exit;
}
}