cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug36303.phpt
| From: | Dmitry Stogov | Date: | Mon, 06 Feb 2006 11:46:12 +0000 |
| Subject: | cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug36303.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4569@lists.php.net to get a copy of this message | ||
dmitry Mon Feb 6 11:46:12 2006 UTC
Modified files:
/ZendEngine2 zend_vm_def.h zend_vm_execute.h
/ZendEngine2/tests bug36303.phpt
Log:
Fixed bug #36303 (foreach on error_zval produces segfault)
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_vm_def.h?r1=1.92&r2=1.93&diff_format=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.92 ZendEngine2/zend_vm_def.h:1.93
--- ZendEngine2/zend_vm_def.h:1.92 Sun Feb 5 23:26:55 2006
+++ ZendEngine2/zend_vm_def.h Mon Feb 6 11:46:12 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_vm_def.h,v 1.92 2006/02/05 23:26:55 helly Exp $ */
+/* $Id: zend_vm_def.h,v 1.93 2006/02/06 11:46:12 dmitry Exp $ */
/* If you change this file, please regenerate the zend_vm_execute.h and
* zend_vm_opcodes.h files by running:
@@ -3058,7 +3058,9 @@
}
array_ptr = *array_ptr_ptr;
} else {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ }
array_ptr = *array_ptr_ptr;
array_ptr->refcount++;
}
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_vm_execute.h?r1=1.96&r2=1.97&diff_format=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.96 ZendEngine2/zend_vm_execute.h:1.97
--- ZendEngine2/zend_vm_execute.h:1.96 Sun Feb 5 23:26:55 2006
+++ ZendEngine2/zend_vm_execute.h Mon Feb 6 11:46:12 2006
@@ -1997,7 +1997,9 @@
}
array_ptr = *array_ptr_ptr;
} else {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ }
array_ptr = *array_ptr_ptr;
array_ptr->refcount++;
}
@@ -4495,7 +4497,9 @@
}
array_ptr = *array_ptr_ptr;
} else {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ }
array_ptr = *array_ptr_ptr;
array_ptr->refcount++;
}
@@ -7590,7 +7594,9 @@
}
array_ptr = *array_ptr_ptr;
} else {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ }
array_ptr = *array_ptr_ptr;
array_ptr->refcount++;
}
@@ -20230,7 +20236,9 @@
}
array_ptr = *array_ptr_ptr;
} else {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ }
array_ptr = *array_ptr_ptr;
array_ptr->refcount++;
}
http://cvs.php.net/viewcvs.cgi/ZendEngine2/tests/bug36303.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/bug36303.phpt
diff -u /dev/null ZendEngine2/tests/bug36303.phpt:1.2
--- /dev/null Mon Feb 6 11:46:12 2006
+++ ZendEngine2/tests/bug36303.phpt Mon Feb 6 11:46:12 2006
@@ -0,0 +1,12 @@
+--TEST--
+Bug #36303 (foreach on error_zval produces segfault)
+--FILE--
+<?php
+$x="test";
+foreach($x->a->b as &$v) {
+}
+echo "ok\n";
+?>
+--EXPECTF--
+Warning: Invalid argument supplied for foreach() in %sbug36303.php on line 3
+ok