cvs: ZendEngine2(PHP_5_3) / zend_execute_API.c zend_vm_def.h zend_vm_execute.h

[email protected] ("Dmitry Stogov")
Newsgroups php.zend-engine.cvs
Message-ID <cvsdmitry1204631034@cvsserver>
dmitry		Tue Mar  4 11:43:54 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /ZendEngine2	zend_execute_API.c zend_vm_def.h zend_vm_execute.h 
  Log:
  Fixed shared memory corruption of opcode caches
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.24.2.26&r2=1.331.2.20.2.24.2.27&diff_format=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.26 ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.27
--- ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.26	Sat Feb 23 17:06:19 2008
+++ ZendEngine2/zend_execute_API.c	Tue Mar  4 11:43:51 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.26 2008/02/23 17:06:19 helly Exp $ */
+/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.27 2008/03/04 11:43:51 dmitry Exp $ */
 
 #include <stdio.h>
 #include <signal.h>
@@ -466,6 +466,19 @@
 #define Z_REAL_TYPE_P(p)			(Z_TYPE_P(p) & ~IS_VISITED_CONSTANT)
 #define MARK_CONSTANT_VISITED(p)	Z_TYPE_P(p) |= IS_VISITED_CONSTANT
 
+static void zval_deep_copy(zval **p)
+{
+	zval *value;
+
+	ALLOC_ZVAL(value);
+	*value = **p;
+	Z_TYPE_P(value) &= ~IS_CONSTANT_INDEX;
+	zval_copy_ctor(value);
+	Z_TYPE_P(value) = Z_TYPE_PP(p);
+	INIT_PZVAL(value);
+	*p = value;
+}
+
 ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC) /* {{{ */
 {
 	zval *p = *pp;
@@ -531,6 +544,16 @@
 		p = *pp;
 		Z_TYPE_P(p) = IS_ARRAY;
 
+		if (!inline_change) {
+			zval *tmp;
+			HashTable *tmp_ht = NULL;
+
+			ALLOC_HASHTABLE(tmp_ht);
+			zend_hash_init(tmp_ht, zend_hash_num_elements(Z_ARRVAL_P(p)), NULL, ZVAL_PTR_DTOR, 0);
+			zend_hash_copy(tmp_ht, Z_ARRVAL_P(p), (copy_ctor_func_t) zval_deep_copy, (void *) &tmp, sizeof(zval *));
+			Z_ARRVAL_P(p) = tmp_ht;
+		} 
+
 		/* First go over the array and see if there are any constant indices */
 		zend_hash_internal_pointer_reset(Z_ARRVAL_P(p));
 		while (zend_hash_get_current_data(Z_ARRVAL_P(p), (void **) &element) == SUCCESS) {
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.59.2.29.2.48.2.39&r2=1.59.2.29.2.48.2.40&diff_format=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.39 ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.40
--- ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.39	Tue Mar  4 10:06:52 2008
+++ ZendEngine2/zend_vm_def.h	Tue Mar  4 11:43:51 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.39 2008/03/04 10:06:52 dmitry Exp $ */
+/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.40 2008/03/04 11:43:51 dmitry Exp $ */
 
 /* If you change this file, please regenerate the zend_vm_execute.h and
  * zend_vm_opcodes.h files by running:
@@ -2598,9 +2598,6 @@
 
 			ALLOC_ZVAL(default_value);
 			*default_value = opline->op2.u.constant;
-			if (Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) {
-				zval_copy_ctor(default_value);
-			}
 			Z_SET_REFCOUNT_P(default_value, 1);
 			zval_update_constant(&default_value, 0 TSRMLS_CC);
 			Z_SET_REFCOUNT_P(default_value, 0);
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.62.2.30.2.49.2.38&r2=1.62.2.30.2.49.2.39&diff_format=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.38 ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.39
--- ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.38	Tue Mar  4 10:06:52 2008
+++ ZendEngine2/zend_vm_execute.h	Tue Mar  4 11:43:51 2008
@@ -723,9 +723,6 @@
 
 			ALLOC_ZVAL(default_value);
 			*default_value = opline->op2.u.constant;
-			if (Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) {
-				zval_copy_ctor(default_value);
-			}
 			Z_SET_REFCOUNT_P(default_value, 1);
 			zval_update_constant(&default_value, 0 TSRMLS_CC);
 			Z_SET_REFCOUNT_P(default_value, 0);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.