cvs: ZendEngine2 / zend_execute.c zend_execute.h
| From: | Andi Gutmans | Date: | Tue, 21 Sep 2004 22:09:23 +0000 |
| Subject: | cvs: ZendEngine2 / zend_execute.c zend_execute.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-2995@lists.php.net to get a copy of this message | ||
andi Tue Sep 21 18:09:23 2004 EDT
Modified files:
/ZendEngine2 zend_execute.c zend_execute.h
Log:
- Fix for bug #29707
http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.674&r2=1.675&ty=u
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.674 ZendEngine2/zend_execute.c:1.675
--- ZendEngine2/zend_execute.c:1.674 Mon Sep 13 06:41:39 2004
+++ ZendEngine2/zend_execute.c Tue Sep 21 18:09:22 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.c,v 1.674 2004/09/13 10:41:39 stas Exp $ */
+/* $Id: zend_execute.c,v 1.675 2004/09/21 22:09:22 andi Exp $ */
#define ZEND_INTENSIVE_DEBUGGING 0
@@ -137,27 +137,31 @@
} else {
temp_variable *T = &T(node->u.var);
zval *str = T->str_offset.str;
+ zval *ptr;
/* string offset */
- should_free->var = &T(node->u.var).tmp_var;
+ ALLOC_ZVAL(ptr);
+ T->str_offset.ptr = ptr;
+ should_free->var = ptr;
+ should_free->is_var = 1;
if (T->str_offset.str->type != IS_STRING
|| ((int)T->str_offset.offset<0)
|| (T->str_offset.str->value.str.len <= T->str_offset.offset)) {
zend_error(E_NOTICE, "Uninitialized string offset: %d", T->str_offset.offset);
- T->tmp_var.value.str.val = STR_EMPTY_ALLOC();
- T->tmp_var.value.str.len = 0;
+ ptr->value.str.val = STR_EMPTY_ALLOC();
+ ptr->value.str.len = 0;
} else {
char c = str->value.str.val[T->str_offset.offset];
- T->tmp_var.value.str.val = estrndup(&c, 1);
- T->tmp_var.value.str.len = 1;
+ ptr->value.str.val = estrndup(&c, 1);
+ ptr->value.str.len = 1;
}
PZVAL_UNLOCK_FREE(str);
- T->tmp_var.refcount=1;
- T->tmp_var.is_ref=1;
- T->tmp_var.type = IS_STRING;
- return &T->tmp_var;
+ ptr->refcount=1;
+ ptr->is_ref=1;
+ ptr->type = IS_STRING;
+ return ptr;
}
break;
case IS_UNUSED:
@@ -174,11 +178,12 @@
if (node->op_type==IS_VAR) {
if (T(node->u.var).var.ptr_ptr) {
PZVAL_UNLOCK(*T(node->u.var).var.ptr_ptr, should_free);
+ return T(node->u.var).var.ptr_ptr;
} else {
/* string offset */
PZVAL_UNLOCK(T(node->u.var).str_offset.str, should_free);
+ return NULL;
}
- return T(node->u.var).var.ptr_ptr;
} else {
should_free->var = 0;
return NULL;
@@ -539,20 +544,7 @@
T->str_offset.str->value.str.val[T->str_offset.offset] =
final_value->value.str.val[0];
if (op2) {
- if (op2->op_type == IS_VAR) {
- if (value == &T(op2->u.var).tmp_var) {
- 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_ZVAL(value);
- *value = T(op2->u.var).tmp_var;
- value->is_ref = 0;
- value->refcount = 0; /* LOCK will increase it */
- }
- }
- } else {
+ if (op2->op_type == IS_TMP_VAR) {
if (final_value == &T(op2->u.var).tmp_var) {
/* we can safely free final_value here
* because separation is done only
@@ -827,6 +819,7 @@
}
}
switch (opline->op2.u.EA.type) {
+ case ZEND_FETCH_GLOBAL:
case ZEND_FETCH_LOCAL:
FREE_OP(free_op1);
break;
http://cvs.php.net/diff.php/ZendEngine2/zend_execute.h?r1=1.75&r2=1.76&ty=u
Index: ZendEngine2/zend_execute.h
diff -u ZendEngine2/zend_execute.h:1.75 ZendEngine2/zend_execute.h:1.76
--- ZendEngine2/zend_execute.h:1.75 Thu Sep 9 12:47:22 2004
+++ ZendEngine2/zend_execute.h Tue Sep 21 18:09:22 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.h,v 1.75 2004/09/09 16:47:22 andi Exp $ */
+/* $Id: zend_execute.h,v 1.76 2004/09/21 22:09:22 andi Exp $ */
#ifndef ZEND_EXECUTE_H
#define ZEND_EXECUTE_H
@@ -35,7 +35,9 @@
zend_bool fcall_returned_reference;
} var;
struct {
- zval tmp_var;
+ zval **ptr_ptr;
+ zval *ptr;
+ zend_bool fcall_returned_reference;
zval *str;
zend_uint offset;
} str_offset;