summaryrefslogtreecommitdiff
path: root/ext/standard/array.c
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2002-08-01 16:39:52 +0000
committerfoobar <sniper@php.net>2002-08-01 16:39:52 +0000
commit6df2b90c05d5894f64f9eb33dff8a013f1e593f4 (patch)
treea1bedbb06d3d8fb8607b8d36cb7c2c647b3fa517 /ext/standard/array.c
parent362fc4ee76967a7ebdd6490e522ace26b1ddc1c2 (diff)
downloadphp-git-6df2b90c05d5894f64f9eb33dff8a013f1e593f4.tar.gz
Reset index when doing array_pop()
Diffstat (limited to 'ext/standard/array.c')
-rw-r--r--ext/standard/array.c5
1 files changed, 4 insertions, 1 deletions
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));
}
}
/* }}} */