cvs: Zend(PHP_4_4) / zend_execute.c php-src NEWS
| From: | Dmitry Stogov | Date: | Thu, 13 Apr 2006 06:16:42 +0000 |
| Subject: | cvs: Zend(PHP_4_4) / zend_execute.c php-src NEWS | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4810@lists.php.net to get a copy of this message | ||
dmitry Thu Apr 13 06:16:42 2006 UTC
Modified files: (Branch: PHP_4_4)
/php-src NEWS
/Zend zend_execute.c
Log:
Fixed bug #37046 (foreach breaks static scope)
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.1247.2.920.2.123&r2=1.1247.2.920.2.124&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.920.2.123 php-src/NEWS:1.1247.2.920.2.124
--- php-src/NEWS:1.1247.2.920.2.123 Sun Mar 26 17:12:57 2006
+++ php-src/NEWS Thu Apr 13 06:16:42 2006
@@ -4,6 +4,7 @@
- Updated PCRE to version 6.6. (Andrei)
- Added overflow checks to wordwrap() function. (Ilia)
- Added a check for special characters in the session name. (Ilia)
+- Fixed bug #37046 (foreach breaks static scope). (Dmitry)
- Fixed bug #36857 (Added support for partial content fetching to the HTTP
streams wrapper). (Ilia)
- Fixed bug #36776 (node_list_wrapper_dtor segfault). (Rob)
http://cvs.php.net/viewcvs.cgi/Zend/zend_execute.c?r1=1.316.2.49.2.14&r2=1.316.2.49.2.15&diff_format=u
Index: Zend/zend_execute.c
diff -u Zend/zend_execute.c:1.316.2.49.2.14 Zend/zend_execute.c:1.316.2.49.2.15
--- Zend/zend_execute.c:1.316.2.49.2.14 Sun Jan 1 13:46:49 2006
+++ Zend/zend_execute.c Thu Apr 13 06:16:42 2006
@@ -2397,7 +2397,22 @@
INIT_PZVAL(tmp);
array_ptr = tmp;
} else {
- array_ptr->refcount++;
+ if (EX(opline)->op1.op_type == IS_VAR &&
+ !array_ptr->is_ref &&
+ array_ptr->refcount > 1) {
+ /* non-separated return value from function */
+ zval *tmp;
+
+ ALLOC_ZVAL(tmp);
+ tmp->value = array_ptr->value;
+ tmp->type = array_ptr->type;
+ tmp->is_ref = 0;
+ tmp->refcount = 1;
+ zval_copy_ctor(tmp);
+ array_ptr = tmp;
+ } else {
+ array_ptr->refcount++;
+ }
}
}
PZVAL_LOCK(array_ptr);