From: Andi Gutmans Date: Wed, 19 Jan 2000 17:39:55 +0000 (+0000) Subject: - Run destructor before the hash structure is modified, thus, making X-Git-Tag: BEFORE_SAPIFICATION_FEB_10_2000~200 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7b97df93f469d72238c6c685109e1c455236f9e;p=php - Run destructor before the hash structure is modified, thus, making hash_del, reentrant (BLOCK_INTERRUPTIONS needs to be made a counter now). --- diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 88bcd588e5..8bb06df5c2 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -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); }