diff options
author | Matt Wilmas <mattwil@php.net> | 2009-06-07 19:28:15 +0000 |
---|---|---|
committer | Matt Wilmas <mattwil@php.net> | 2009-06-07 19:28:15 +0000 |
commit | dca18b68d11308f94acec7e62336fce9ae8222c8 (patch) | |
tree | d0a6dc7bc1f980ec5a36e30080ccc20883413143 /Zend/zend_hash.c | |
parent | 2462fce2442c6904995c265f48c145e4c82d8e9f (diff) | |
download | php-git-dca18b68d11308f94acec7e62336fce9ae8222c8.tar.gz |
MFH: Fixed bug #47836 (array operator [] inconsistency when the array has PHP_INT_MAX index value)
Also simplified related array_push() test
Diffstat (limited to 'Zend/zend_hash.c')
-rw-r--r-- | Zend/zend_hash.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index f960766535..e243d0fac7 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -376,7 +376,7 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void UPDATE_DATA(ht, p, pData, nDataSize); HANDLE_UNBLOCK_INTERRUPTIONS(); if ((long)h >= (long)ht->nNextFreeElement) { - ht->nNextFreeElement = h + 1; + ht->nNextFreeElement = h < LONG_MAX ? h + 1 : LONG_MAX; } if (pDest) { *pDest = p->pData; @@ -404,7 +404,7 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void HANDLE_UNBLOCK_INTERRUPTIONS(); if ((long)h >= (long)ht->nNextFreeElement) { - ht->nNextFreeElement = h + 1; + ht->nNextFreeElement = h < LONG_MAX ? h + 1 : LONG_MAX; } ht->nNumOfElements++; ZEND_HASH_IF_FULL_DO_RESIZE(ht); |