]> granicus.if.org Git - php/commitdiff
- Run destructor before the hash structure is modified, thus, making
authorAndi Gutmans <andi@php.net>
Wed, 19 Jan 2000 17:39:55 +0000 (17:39 +0000)
committerAndi Gutmans <andi@php.net>
Wed, 19 Jan 2000 17:39:55 +0000 (17:39 +0000)
  hash_del, reentrant (BLOCK_INTERRUPTIONS needs to be made a counter now).

Zend/zend_hash.c

index 88bcd588e556c8680067c3f5b9f6488df2e83b74..8bb06df5c2f3ca0aec4b4cd6cbf4a01934ae3997 100644 (file)
@@ -537,6 +537,9 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLen
                if ((p->h == h) && ((p->nKeyLength == 0) || /* Numeric index */
                        ((p->nKeyLength == nKeyLength) && (!memcmp(p->arKey, arKey, nKeyLength))))) {
                        HANDLE_BLOCK_INTERRUPTIONS();
+                       if (ht->pDestructor) {
+                               ht->pDestructor(p->pData);
+                       }
                        if (p == ht->arBuckets[nIndex]) {
                                ht->arBuckets[nIndex] = p->pNext;
                        } else {
@@ -553,9 +556,6 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLen
                        } else {
                                ht->pListTail = p->pListLast;
                        }
-                       if (ht->pDestructor) {
-                               ht->pDestructor(p->pData);
-                       }
                        if (!p->pDataPtr) {
                                pefree(p->pData,ht->persistent);
                        }