]> granicus.if.org Git - php/commitdiff
Fixed bug #38315 (Constructing in the destructor causes weird behaviour)
authorDmitry Stogov <dmitry@php.net>
Thu, 24 Aug 2006 09:42:35 +0000 (09:42 +0000)
committerDmitry Stogov <dmitry@php.net>
Thu, 24 Aug 2006 09:42:35 +0000 (09:42 +0000)
NEWS
Zend/zend_hash.c

diff --git a/NEWS b/NEWS
index 5b464025dabc0725252843d4fb551b5d0990169d..5a4fb6df23fd1e576a358497c40c32d39d7f5373 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ PHP                                                                        NEWS
   (Ilia)
 - Fixed bug #38488 (Access to "php://stdin" and family crashes PHP on win32).
   (Dmitry)
+- Fixed bug #38315 (Constructing in the destructor causes weird behaviour).
+  (Dmitry)
 - Fixed bug #38265 (heap corruption). (Dmitry)
 - Fixed PECL bug #8112 (OCI8 persistent connections misbehave when Apache 
   process times out). (Tony)
index 806a5d6f88f81d6f737d57b5c9d5b5be525e9af4..e5e127f0f59620bb4555fcd8738825f49c7b6982 100644 (file)
@@ -571,15 +571,6 @@ static Bucket *zend_hash_apply_deleter(HashTable *ht, Bucket *p)
        Bucket *retval;
 
        HANDLE_BLOCK_INTERRUPTIONS();
-
-       if (ht->pDestructor) {
-               ht->pDestructor(p->pData);
-       }
-       if (p->pData != &p->pDataPtr) {
-               pefree(p->pData, ht->persistent);
-       }
-       retval = p->pListNext;
-
        if (p->pLast) {
                p->pLast->pNext = p->pNext;
        } else {
@@ -608,9 +599,17 @@ static Bucket *zend_hash_apply_deleter(HashTable *ht, Bucket *p)
        if (ht->pInternalPointer == p) {
                ht->pInternalPointer = p->pListNext;
        }
-       pefree(p, ht->persistent);
-       HANDLE_UNBLOCK_INTERRUPTIONS();
        ht->nNumOfElements--;
+       HANDLE_UNBLOCK_INTERRUPTIONS();
+
+       if (ht->pDestructor) {
+               ht->pDestructor(p->pData);
+       }
+       if (p->pData != &p->pDataPtr) {
+               pefree(p->pData, ht->persistent);
+       }
+       retval = p->pListNext;
+       pefree(p, ht->persistent);
 
        return retval;
 }