summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2012-10-18 15:53:12 +0800
committerXinchen Hui <laruence@php.net>2012-10-18 15:53:12 +0800
commit804ab5dc48e6f7632aea7401adb328dd8c86c456 (patch)
treec58a39a2a5d886d60fcef509e0bbf98660eff5c8
parent5414856ffb0dc4da1c8ec1c449690e4b9f5c798d (diff)
parentccc519b7a92bfe4b191c0e2e3869516171247ac2 (diff)
downloadphp-git-804ab5dc48e6f7632aea7401adb328dd8c86c456.tar.gz
Merge branch 'PHP-5.4'
-rw-r--r--Zend/tests/bug63055.phpt23
-rw-r--r--Zend/zend_gc.h2
2 files changed, 24 insertions, 1 deletions
diff --git a/Zend/tests/bug63055.phpt b/Zend/tests/bug63055.phpt
new file mode 100644
index 0000000000..0901e5b34e
--- /dev/null
+++ b/Zend/tests/bug63055.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #63055 (Segfault in zend_gc with SF2 testsuite)
+--FILE--
+<?php
+for ($i=0; $i<9998; $i++) {
+ $array = array();
+ $array[0] = &$array;
+ unset($array);
+}
+
+$matches = array("foo" => "bar");
+$dummy = array("dummy");
+$dummy[1] = &$dummy;
+
+$matches[1] = &$matches;
+$matches[2] = $dummy;
+
+$ma = $matches;
+preg_match_all("/(\d)+/", "foo123456bar", $matches);
+echo "okey";
+?>
+--EXPECTF--
+okey
diff --git a/Zend/zend_gc.h b/Zend/zend_gc.h
index ba30b3aa3b..1f86f19b71 100644
--- a/Zend/zend_gc.h
+++ b/Zend/zend_gc.h
@@ -179,7 +179,7 @@ END_EXTERN_C()
static zend_always_inline void gc_zval_check_possible_root(zval *z TSRMLS_DC)
{
- if (z->type == IS_ARRAY || z->type == IS_OBJECT) {
+ if ((z->type == IS_ARRAY && !z->value.ht->inconsistent) || z->type == IS_OBJECT) {
gc_zval_possible_root(z TSRMLS_CC);
}
}