summaryrefslogtreecommitdiff
path: root/Zend/zend_hash.h
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2015-03-08 00:15:55 +0800
committerXinchen Hui <laruence@php.net>2015-03-08 00:21:02 +0800
commit95b4aa529336ede207dbd2d114521c60ec4f2ccb (patch)
tree9259774da4268a4dffc2efe040b72e0273045f66 /Zend/zend_hash.h
parentafad979c60e4b54b65a6fd7345d476076a7a9a03 (diff)
downloadphp-git-95b4aa529336ede207dbd2d114521c60ec4f2ccb.tar.gz
Fixed zend_hash_append result duplicated key
actually, maybe we should precalculate before calling zend_hash_appen when we are not sure whether the hash is caclculated(prop_info->name). but it looks a little ugly.. (also for zend_string_copy)
Diffstat (limited to 'Zend/zend_hash.h')
-rw-r--r--Zend/zend_hash.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index 1e166ac8c3..02991a643b 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -818,8 +818,8 @@ static zend_always_inline void _zend_hash_append(HashTable *ht, zend_string *key
Bucket *p = ht->arData + idx;
ZVAL_COPY_VALUE(&p->val, zv);
- p->key = key;
- p->h = key->h;
+ p->key = zend_string_copy(key);
+ p->h = zend_string_hash_val(key);
nIndex = p->h & ht->nTableMask;
Z_NEXT(p->val) = ht->arHash[nIndex];
ht->arHash[nIndex] = idx;
@@ -834,8 +834,8 @@ static zend_always_inline void _zend_hash_append_ptr(HashTable *ht, zend_string
Bucket *p = ht->arData + idx;
ZVAL_PTR(&p->val, ptr);
- p->key = key;
- p->h = key->h;
+ p->key = zend_string_copy(key);
+ p->h = zend_string_hash_val(key);
nIndex = p->h & ht->nTableMask;
Z_NEXT(p->val) = ht->arHash[nIndex];
ht->arHash[nIndex] = idx;
@@ -850,8 +850,8 @@ static zend_always_inline void _zend_hash_append_ind(HashTable *ht, zend_string
Bucket *p = ht->arData + idx;
ZVAL_INDIRECT(&p->val, ptr);
- p->key = key;
- p->h = key->h;
+ p->key = zend_string_copy(key);
+ p->h = zend_string_hash_val(key);
nIndex = p->h & ht->nTableMask;
Z_NEXT(p->val) = ht->arHash[nIndex];
ht->arHash[nIndex] = idx;