summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2006-08-24 09:42:35 +0000
committerDmitry Stogov <dmitry@php.net>2006-08-24 09:42:35 +0000
commitc42b3bf689389ae0f22448183c77dc96c7114bd2 (patch)
treeb669cf99fb9aa91c85ac0aee43cff7051bf4cc9a
parent92f1b46fbba7873c1256d64eac2dac5f7ffc7c1b (diff)
downloadphp-git-c42b3bf689389ae0f22448183c77dc96c7114bd2.tar.gz
Fixed bug #38315 (Constructing in the destructor causes weird behaviour)
-rw-r--r--NEWS2
-rw-r--r--Zend/zend_hash.c21
2 files changed, 12 insertions, 11 deletions
diff --git a/NEWS b/NEWS
index 5b464025da..5a4fb6df23 100644
--- 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)
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index 806a5d6f88..e5e127f0f5 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -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;
}