mirror of
https://github.com/php/php-src.git
synced 2024-12-20 07:20:33 +08:00
Fixed assignment to reference
This commit is contained in:
parent
3f794ba743
commit
7cd78822ab
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user