summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2003-06-16 15:41:02 +0000
committerStanislav Malyshev <stas@php.net>2003-06-16 15:41:02 +0000
commitf205abb3f82f4ede5f83645b6a4fc084f7bc8636 (patch)
treead18cda7ad6a5175d8530e93eb1353b7f264348a
parent466ef9fd91bc6e514c45c4fbd8a21fe79dc123f8 (diff)
downloadphp-git-f205abb3f82f4ede5f83645b6a4fc084f7bc8636.tar.gz
Fix bug #22592 - cascading assignments to string offsets
-rw-r--r--Zend/zend_execute.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 73a9ba6a3b..29c57a90bf 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -470,7 +470,16 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
if (op2) {
if (op2->op_type == IS_VAR) {
if (value == &T(op2->u.var).tmp_var) {
- STR_FREE(value->value.str.val);
+ if(result->u.EA.type & EXT_TYPE_UNUSED) {
+ /* We are not going to use return value, drop it */
+ STR_FREE(value->value.str.val);
+ } else {
+ /* We are going to use return value, make it real zval */
+ ALLOC_INIT_ZVAL(value);
+ *value = T(op2->u.var).tmp_var;
+ value->is_ref = 0;
+ value->refcount = 0; /* LOCK will increase it */
+ }
}
} else {
if (final_value == &T(op2->u.var).tmp_var) {
@@ -495,7 +504,8 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
- T(result->u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr);
+/* T(result->u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); */
+ T(result->u.var).var.ptr_ptr = &value;
SELECTIVE_PZVAL_LOCK(*T(result->u.var).var.ptr_ptr, result);
AI_USE_PTR(T(result->u.var).var);
return;