From: foobar Date: Thu, 1 Aug 2002 16:39:52 +0000 (+0000) Subject: Reset index when doing array_pop() X-Git-Tag: dev~61 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6df2b90c05d5894f64f9eb33dff8a013f1e593f4;p=php Reset index when doing array_pop() --- diff --git a/ext/standard/array.c b/ext/standard/array.c index 75874ceda7..0e29e5ccec 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1695,7 +1695,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) zend_hash_del_key_or_index(Z_ARRVAL_PP(stack), key, key_len, index, (key) ? HASH_DEL_KEY : HASH_DEL_INDEX); /* If we did a shift... re-index like it did before */ - if(!off_the_end) { + if (!off_the_end) { HANDLE_BLOCK_INTERRUPTIONS(); { int k = 0; @@ -1709,6 +1709,9 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) zend_hash_rehash(Z_ARRVAL_PP(stack)); } HANDLE_UNBLOCK_INTERRUPTIONS(); + } else { + Z_ARRVAL_PP(stack)->nNextFreeElement--; + zend_hash_rehash(Z_ARRVAL_PP(stack)); } } /* }}} */