From 56c474cf48344b040891f2618d33ef09a0e8be7e Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Thu, 28 Sep 2000 15:17:50 +0000 Subject: [PATCH] Make hash_copy call copy constructor on a real copy, not on a temp --- Zend/zend_hash.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 88dd1cc0f0..280fc0b679 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -750,21 +750,21 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, int (*destruct)(void ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size) { Bucket *p; + void *new_entry; IS_CONSISTENT(source); IS_CONSISTENT(target); p = source->pListHead; while (p) { - memcpy(tmp, p->pData, size); - if (pCopyConstructor) { - pCopyConstructor(tmp); - } if (p->nKeyLength) { - zend_hash_update(target, p->arKey, p->nKeyLength, tmp, size, NULL); + zend_hash_update(target, p->arKey, p->nKeyLength, p->pData, size, &new_entry); } else { - zend_hash_index_update(target, p->h, tmp, size, NULL); + zend_hash_index_update(target, p->h, p->pData, size, &new_entry); } + if (pCopyConstructor) { + pCopyConstructor(new_entry); + } p = p->pListNext; } target->pInternalPointer = target->pListHead; -- 2.50.1