cvs: php4 /ext/standard array.c
| From: | Brad LaFountain | Date: | Thu, 01 Aug 2002 17:34:32 +0000 |
| Subject: | cvs: php4 /ext/standard array.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-13086@lists.php.net to get a copy of this message | ||
rodif_bl Thu Aug 1 13:34:32 2002 EDT
Modified files:
/php4/ext/standard array.c
Log:
array_pop wasnt setting next index
Index: php4/ext/standard/array.c
diff -u php4/ext/standard/array.c:1.179 php4/ext/standard/array.c:1.180
--- php4/ext/standard/array.c:1.179 Thu Aug 1 12:44:47 2002
+++ php4/ext/standard/array.c Thu Aug 1 13:34:31 2002
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.179 2002/08/01 16:44:47 sniper Exp $ */
+/* $Id: array.c,v 1.180 2002/08/01 17:34:31 rodif_bl Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -1663,7 +1663,7 @@
zval **stack, /* Input stack */
**val; /* Value to be popped */
char *key = NULL;
- int key_len;
+ int key_len = 0;
ulong index;
/* Get the arguments and do error-checking */
@@ -1696,19 +1696,16 @@
/* If we did a shift... re-index like it did before */
if (!off_the_end) {
- HANDLE_BLOCK_INTERRUPTIONS();
- {
- int k = 0;
- Bucket *p = Z_ARRVAL_PP(stack)->pListHead;
- while (p != NULL) {
- if (p->nKeyLength == 0)
- p->h = k++;
- p = p->pListNext;
- }
- Z_ARRVAL_PP(stack)->nNextFreeElement = k+1;
- zend_hash_rehash(Z_ARRVAL_PP(stack));
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
+ int k = 0;
+ Bucket *p = Z_ARRVAL_PP(stack)->pListHead;
+ while (p != NULL) {
+ if (p->nKeyLength == 0)
+ p->h = k++;
+ p = p->pListNext;
+ }
+ Z_ARRVAL_PP(stack)->nNextFreeElement = k+1;
+ } else if(!key_len) {
+ Z_ARRVAL_PP(stack)->nNextFreeElement = Z_ARRVAL_PP(stack)->nNextFreeElement - 1;
}
}
/* }}} */