cvs: php4 /ext/standard array.c
| From: | Jani Taskinen | Date: | Wed, 31 Jul 2002 13:49:51 +0000 |
| Subject: | cvs: php4 /ext/standard array.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-13059@lists.php.net to get a copy of this message | ||
sniper Wed Jul 31 09:49:51 2002 EDT
Modified files:
/php4/ext/standard array.c
Log:
Reverted the patch..it breaks the original behaviour of at least array_shift.
Index: php4/ext/standard/array.c
diff -u php4/ext/standard/array.c:1.173 php4/ext/standard/array.c:1.174
--- php4/ext/standard/array.c:1.173 Tue Jul 30 18:54:12 2002
+++ php4/ext/standard/array.c Wed Jul 31 09:49:50 2002
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.173 2002/07/30 22:54:12 rodif_bl Exp $ */
+/* $Id: array.c,v 1.174 2002/07/31 13:49:50 sniper Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -1661,9 +1661,8 @@
static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
{
zval **stack, /* Input stack */
- **val; /* Value to be popped */
- char *key = NULL;
- int key_len;
+ **val; /* Value to be popped */
+ HashTable *new_hash; /* New stack */
/* Get the arguments and do error-checking */
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &stack) == FAILURE) {
@@ -1690,8 +1689,10 @@
INIT_PZVAL(return_value);
/* Delete the first or last value */
- zend_hash_get_current_key_ex(Z_ARRVAL_PP(stack), &key, &key_len, &key_len, 0, NULL);
- zend_hash_del_key_or_index(Z_ARRVAL_PP(stack), key, key_len, key_len, (key) ? HASH_DEL_KEY :
HASH_DEL_INDEX);
+ new_hash = php_splice(Z_ARRVAL_PP(stack), (off_the_end) ? -1 : 0, 1, NULL, 0, NULL);
+ zend_hash_destroy(Z_ARRVAL_PP(stack));
+ efree(Z_ARRVAL_PP(stack));
+ Z_ARRVAL_PP(stack) = new_hash;
}
/* }}} */