com php-src: Fixed passing argument by refefence from internal functions: Zend/zend_execute_API.c Zend/zend_interfaces.c Ze nd/zend_variables.c
| From: | Dmitry Stogov | Date: | Thu, 20 Mar 2014 13:03:32 +0000 |
| Subject: | com php-src: Fixed passing argument by refefence from internal functions: Zend/zend_execute_API.c Zend/zend_interfaces.c Ze nd/zend_variables.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77581@lists.php.net to get a copy of this message | ||
Commit: 36cd92a7d3ae83f8169c6d7cead06ecda0b53df3
Author: Dmitry Stogov <dmitry@zend.com> Thu, 20 Mar 2014 17:03:32 +0400
Parents: 1968e6be65fcfabe9dddcd7f7ce4a5d4bf3b7d29
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=36cd92a7d3ae83f8169c6d7cead06ecda0b53df3
Log:
Fixed passing argument by refefence from internal functions
Changed paths:
M Zend/zend_execute_API.c
M Zend/zend_interfaces.c
M Zend/zend_variables.c
Diff:
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 73c00ea...4ffa199 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -867,10 +867,8 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache
TS
ZVAL_NEW_REF(&fci->params[i], &tmp);
Z_ADDREF(fci->params[i]);
} else if (!Z_ISREF(fci->params[i])) {
- if (Z_REFCOUNTED(fci->params[i])) {
- Z_ADDREF(fci->params[i]);
- }
ZVAL_NEW_REF(&fci->params[i], &fci->params[i]);
+ Z_ADDREF(fci->params[i]);
} else if (Z_REFCOUNTED(fci->params[i])) {
Z_ADDREF(fci->params[i]);
}
diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c
index 361a8ce..4f36c91 100644
--- a/Zend/zend_interfaces.c
+++ b/Zend/zend_interfaces.c
@@ -113,6 +113,13 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce,
zend_fun
zend_error(E_CORE_ERROR, "Couldn't execute method %s%s%s", obj_ce ?
obj_ce->name->val : "", obj_ce ? "::" : "", function_name);
}
}
+ /* copy arguments back, they might be changed by references */
+ if (param_count > 0) {
+ ZVAL_COPY_VALUE(arg1, ¶ms[0]);
+ }
+ if (param_count > 1) {
+ ZVAL_COPY_VALUE(arg2, ¶ms[1]);
+ }
if (!retval_ptr) {
zval_ptr_dtor(&retval);
return NULL;
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
index c7faba8..995a648 100644
--- a/Zend/zend_variables.c
+++ b/Zend/zend_variables.c
@@ -78,7 +78,7 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
case IS_REFERENCE: {
zend_reference *ref = (zend_reference*)p;
if (--ref->gc.refcount == 0) {
- zval_dtor(&ref->val);
+ zval_ptr_dtor(&ref->val);
goto gc_exit;
}
goto exit;
@@ -142,7 +142,7 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
case IS_REFERENCE: {
zend_reference *ref = (zend_reference*)p;
- zval_dtor(&ref->val);
+ zval_ptr_dtor(&ref->val);
goto gc_exit;
}
default: