Skip to content

Commit b6eb324

Browse files
author
Andi Gutmans
committed
- Merge from Engine 1
1 parent d4a6487 commit b6eb324

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

Zend/zend_execute.c

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,30 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
308308
if (!variable_ptr_ptr) {
309309
switch (Ts[op1->u.var].EA.type) {
310310
case IS_OVERLOADED_OBJECT:
311-
set_overloaded_property(&Ts[op1->u.var], value TSRMLS_CC);
312-
if (type == IS_TMP_VAR) {
313-
zval_dtor(value);
311+
{
312+
int return_value_used;
313+
314+
return_value_used = result && !(result->u.EA.type & EXT_TYPE_UNUSED);
315+
316+
if (return_value_used) {
317+
if (type == IS_TMP_VAR) {
318+
MAKE_STD_ZVAL(*Ts[result->u.var].var.ptr_ptr);
319+
**Ts[result->u.var].var.ptr_ptr = *value;
320+
INIT_PZVAL(*Ts[result->u.var].var.ptr_ptr);
321+
} else {
322+
Ts[result->u.var].var.ptr_ptr = &value;
323+
PZVAL_LOCK(*Ts[result->u.var].var.ptr_ptr);
324+
}
325+
AI_USE_PTR(Ts[result->u.var].var);
326+
}
327+
328+
set_overloaded_property(&Ts[op1->u.var], value TSRMLS_CC);
329+
330+
if (!return_value_used && type == IS_TMP_VAR) {
331+
zval_dtor(value);
332+
}
333+
break;
314334
}
315-
break;
316335
case IS_STRING_OFFSET: {
317336
temp_variable *T = &Ts[op1->u.var];
318337

0 commit comments

Comments
 (0)