com php-src: Fixed assignment to reference: Zend/zend_execute .c
| From: | Dmitry Stogov | Date: | Fri, 07 Mar 2014 20:02:12 +0000 |
| Subject: | com php-src: Fixed assignment to reference: Zend/zend_execute .c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77678@lists.php.net to get a copy of this message | ||
Commit: 7cd78822abc746e94842bf8b2b566a434fe4c448
Author: Dmitry Stogov <dmitry@zend.com> Sat, 8 Mar 2014 00:02:12 +0400
Parents: 3f794ba743c0b96c4834d914ef45ab909c26bb13
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7cd78822abc746e94842bf8b2b566a434fe4c448
Log:
Fixed assignment to reference
Changed paths:
M Zend/zend_execute.c
Diff:
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 1187638..7977c87 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -954,6 +954,7 @@ static inline zval* zend_assign_const_to_variable(zval *variable_ptr, zval *valu
static inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value TSRMLS_DC)
{
zval garbage;
+ int is_ref = 0;
if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
if (EXPECTED(!Z_ISREF_P(value))) {
@@ -964,11 +965,16 @@ static inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value
TSRM
return variable_ptr;
} else if (Z_ISREF_P(variable_ptr)) {
variable_ptr = Z_REFVAL_P(variable_ptr);
+ is_ref = 1;
}
if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
if (EXPECTED(!Z_ISREF_P(value))) {
- ZVAL_COPY(variable_ptr, value);
+ if (!is_ref) {
+ ZVAL_COPY(variable_ptr, value);
+ } else {
+ ZVAL_DUP(variable_ptr, value);
+ }
} else {
ZVAL_DUP(variable_ptr, Z_REFVAL_P(value));
}