diff options
author | Andrey Hristov <andrey@php.net> | 1999-06-09 22:03:15 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 1999-06-09 22:03:15 +0000 |
commit | f7072fbf879278b69ea7966bcc3e05cf9c681284 (patch) | |
tree | 449dbd80e7945c4c1b4ba0f06ff304d90c16b7e3 /ext/standard/basic_functions.c | |
parent | 2fb5e561238ec59bbcf43d88159eefc487449e43 (diff) | |
download | php-git-f7072fbf879278b69ea7966bcc3e05cf9c681284.tar.gz |
Make array_shift/array_pop work better.
Diffstat (limited to 'ext/standard/basic_functions.c')
-rw-r--r-- | ext/standard/basic_functions.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 43bc22b0c3..56f8f39ad5 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -2571,6 +2571,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) { zval *stack, /* Input stack */ **val; /* Value to be popped */ + HashTable *new_hash; /* New stack */ char *string_key; ulong num_key; @@ -2600,16 +2601,10 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) return_value->is_ref=0; /* Delete the first or last value */ - switch (zend_hash_get_current_key(stack->value.ht, &string_key, &num_key)) { - case HASH_KEY_IS_STRING: - zend_hash_del(stack->value.ht, string_key, strlen(string_key)+1); - efree(string_key); - break; - - case HASH_KEY_IS_LONG: - zend_hash_index_del(stack->value.ht, num_key); - break; - } + new_hash = _phpi_splice(stack->value.ht, (off_the_end) ? -1 : 0, 1, NULL, 0, NULL); + zend_hash_destroy(stack->value.ht); + efree(stack->value.ht); + stack->value.ht = new_hash; } /* }}} */ |