]> granicus.if.org Git - php/commitdiff
- Fixed bug #47341: Calling gc_collect_cycles() with zend.enable_gc=0 causes
authorDerick Rethans <derick@php.net>
Sun, 8 Feb 2009 19:30:01 +0000 (19:30 +0000)
committerDerick Rethans <derick@php.net>
Sun, 8 Feb 2009 19:30:01 +0000 (19:30 +0000)
  segfault.

Zend/tests/gc_031.phpt [new file with mode: 0644]
Zend/zend_gc.c

diff --git a/Zend/tests/gc_031.phpt b/Zend/tests/gc_031.phpt
new file mode 100644 (file)
index 0000000..58c4b15
--- /dev/null
@@ -0,0 +1,11 @@
+--TEST--
+GC 031: gc_collect_roots() with GC turned off.
+--INI--
+zend.enable_gc=0
+--FILE--
+<?php
+gc_collect_cycles();
+echo "DONE\n";
+?>
+--EXPECTF--
+DONE
index 69fbe16603b382257ffb85a97a6b6f8e95f044a3..5475edb3d4a46fc2fa83bfa540f80c7b394a7fce 100644 (file)
@@ -527,7 +527,7 @@ ZEND_API int gc_collect_cycles(TSRMLS_D)
 {
        int count = 0;
 
-       if (GC_G(roots).next != &GC_G(roots)) {
+       if (GC_G(roots).next != &GC_G(roots) && GC_G(roots).next) {
                zval_gc_info *p, *q, *orig_free_list, *orig_next_to_free;
 
                if (GC_G(gc_active)) {