static inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value TSRMLS_DC)
{
zend_refcounted *garbage;
- int is_ref = 0;
+ zval *is_ref = NULL;
if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
if (EXPECTED(!Z_ISREF_P(value))) {
}
return variable_ptr;
} else if (Z_ISREF_P(variable_ptr)) {
+ is_ref = variable_ptr;
variable_ptr = Z_REFVAL_P(variable_ptr);
- is_ref = 1;
}
if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
} else {
ZVAL_DUP(variable_ptr, value);
}
+ } else if (is_ref == value) {
+ return variable_ptr;
} else {
if (Z_REFCOUNT_P(value) == 1) {
//??? auto dereferencing
} else {
ZVAL_DUP(variable_ptr, value);
}
- } else {
+ } else if (is_ref != value) {
assign_ref:
if (Z_REFCOUNT_P(value) == 1) {
//??? auto dereferencing