mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
- Actually the destructor should run after the data is already detached
from the hash but before the bucket is freed.
This commit is contained in:
parent
d3690efffe
commit
99783fe795
@ -537,9 +537,6 @@ 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 {
|
||||
@ -562,6 +559,9 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLen
|
||||
if (ht->pInternalPointer == p) {
|
||||
ht->pInternalPointer = p->pListNext;
|
||||
}
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(p->pData);
|
||||
}
|
||||
pefree(p,ht->persistent);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
ht->nNumOfElements--;
|
||||
|
Loading…
Reference in New Issue
Block a user