com php-src: Fixed bug #60598 (cli/apache sapi segfault on objects manipulation): Zend/tests/bug60598.phpt Zend/zend_objects_A PI.c

From: Date: Wed, 16 Oct 2013 08:21:34 +0000
Subject: com php-src: Fixed bug #60598 (cli/apache sapi segfault on objects manipulation): Zend/tests/bug60598.phpt Zend/zend_objects_A PI.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-73550@lists.php.net to get a copy of this message
Commit: 2e560a331d4e37110a211432f423647cb7d45968 Author: Xinchen Hui <laruence@php.net> Fri, 30 Aug 2013 11:20:24 +0800 Committer: Anatol Belski <ab@php.net> Wed, 16 Oct 2013 01:21:34 -0700 Parents: 9628ac34a6f063c2446b63b311575434cda66141 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2e560a331d4e37110a211432f423647cb7d45968 Log: Fixed bug #60598 (cli/apache sapi segfault on objects manipulation) Bugs: https://bugs.php.net/60598 Changed paths: A Zend/tests/bug60598.phpt M Zend/zend_objects_API.c Diff: diff --git a/Zend/tests/bug60598.phpt b/Zend/tests/bug60598.phpt new file mode 100644 index 0000000..eeee75a --- /dev/null +++ b/Zend/tests/bug60598.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #60598 (cli/apache sapi segfault on objects manipulation) +--FILE-- +<?php +define('OBJECT_COUNT', 10000); + +$containers = array(); + +class Object { + protected $_guid = 0; + public function __construct() { + global $containers; + $this->guid = 1; + $containers[spl_object_hash($this)] = $this; + } + public function __destruct() { + global $containers; + $containers[spl_object_hash($this)] = NULL; + } +} + +for ($i = 0; $i < OBJECT_COUNT; ++$i) { + new Object(); +} + +// You probably won't see this because of the "zend_mm_heap corrupted" +?> +If you see this, try to increase OBJECT_COUNT to 100,000 +--EXPECT-- +If you see this, try to increase OBJECT_COUNT to 100,000 diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index 1fe5d0c..b5dd48f 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -57,6 +57,11 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS obj->dtor(obj->object, i TSRMLS_CC); obj = &objects->object_buckets[i].bucket.obj; obj->refcount--; + + if (obj->refcount == 0) { + /* in case gc_collect_cycle is triggered before free_storage */ + GC_REMOVE_ZOBJ_FROM_BUFFER(obj); + } } } }

« previous php.cvs (#73550) next »