From: foobar Date: Thu, 6 Feb 2003 15:28:28 +0000 (+0000) Subject: MFH: - Fixed bug #22088 (array_shift() leaves next index to be +1 too much) X-Git-Tag: php-4.3.2RC1~326 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2e9cafa7e502c4363bdde21187d8d361346f77f3;p=php MFH: - Fixed bug #22088 (array_shift() leaves next index to be +1 too much) --- diff --git a/ext/standard/array.c b/ext/standard/array.c index 27e990f7c7..d58f1991db 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1724,11 +1724,12 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) int k = 0; Bucket *p = Z_ARRVAL_PP(stack)->pListHead; while (p != NULL) { - if (p->nKeyLength == 0) + if (p->nKeyLength == 0) { p->h = k++; + } p = p->pListNext; } - Z_ARRVAL_PP(stack)->nNextFreeElement = k+1; + Z_ARRVAL_PP(stack)->nNextFreeElement = k; zend_hash_rehash(Z_ARRVAL_PP(stack)); } else if (!key_len) { Z_ARRVAL_PP(stack)->nNextFreeElement = Z_ARRVAL_PP(stack)->nNextFreeElement - 1;