diff options
author | Xinchen Hui <laruence@php.net> | 2015-03-08 00:15:55 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2015-03-08 00:21:02 +0800 |
commit | 95b4aa529336ede207dbd2d114521c60ec4f2ccb (patch) | |
tree | 9259774da4268a4dffc2efe040b72e0273045f66 /Zend/zend_hash.h | |
parent | afad979c60e4b54b65a6fd7345d476076a7a9a03 (diff) | |
download | php-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.h | 12 |
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; |