From: Andi Gutmans Date: Wed, 19 Jan 2000 17:31:33 +0000 (+0000) Subject: - Undo a bug we introduced. (Another one out there). X-Git-Tag: BEFORE_SAPIFICATION_FEB_10_2000~201 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=58fb1a3922331e8a195c29458b8acb711182d50a;p=php - Undo a bug we introduced. (Another one out there). --- diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 0d50676cc9..88bcd588e5 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -522,7 +522,7 @@ ZEND_API int zend_hash_rehash(HashTable *ht) ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag) { uint nIndex; - Bucket *p; + Bucket *p, *t = NULL; /* initialize just to shut gcc up with -Wall */ IS_CONSISTENT(ht); @@ -537,8 +537,10 @@ 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->arBuckets[nIndex] == p) { + if (p == ht->arBuckets[nIndex]) { ht->arBuckets[nIndex] = p->pNext; + } else { + t->pNext = p->pNext; } if (p->pListLast != NULL) { p->pListLast->pListNext = p->pListNext; @@ -565,6 +567,7 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLen ht->nNumOfElements--; return SUCCESS; } + t = p; p = p->pNext; } return FAILURE;