Sort doesn't reindex all arrays (Bug #12572)

From: Date: Sat, 17 Aug 2002 06:45:43 +0000
Subject: Sort doesn't reindex all arrays (Bug #12572)
Groups: php.dev 
Request: Send a blank email to php-dev+get-86928@lists.php.net to get a copy of this message
I want to propose the following patch to Zend to fix a minor inconsistency. The sort() functions reindex arrays of length > 1, but not of length == 1. See http://bugs.php.net/bug.php?id=12572 for an example. The patch is: Index: zend_hash.c =================================================================== RCS file: /repository/Zend/zend_hash.c,v retrieving revision 1.86 diff -u -u -r1.86 zend_hash.c --- zend_hash.c 1 Aug 2002 16:03:21 -0000 1.86 +++ zend_hash.c 17 Aug 2002 06:38:14 -0000 @@ -1115,7 +1115,7 @@ IS_CONSISTENT(ht); - if (ht->nNumOfElements <= 1) { /* Doesn't require sorting */ + if (ht->nNumOfElements < 1) { /* Doesn't require sorting */ return SUCCESS; } arTmp = (Bucket **) pemalloc(ht->nNumOfElements * sizeof(Bucket *), ht->persistent); If this seems good, can someone with Zend permission please apply? Thanks. -adam -- adam maccabee trachtenberg adam@trachtenberg.com

« previous php.dev (#86928) next »