iliaa           Sat Aug  9 16:50:26 2003 EDT

  Added files:                 (Branch: PHP_4_3)
    /php-src/ext/standard/tests/array   bug24897.phpt 

  Modified files:              
    /php-src/ext/standard       array.c 
    /php-src    NEWS 
  Log:
  MFH: Fixed bug #24897 (inconsistent behavior of shuffle() & 
  array_multisort())
  
  
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.199.2.23 php-src/ext/standard/array.c:1.199.2.24
--- php-src/ext/standard/array.c:1.199.2.23     Sat Aug  9 12:47:21 2003
+++ php-src/ext/standard/array.c        Sat Aug  9 16:50:25 2003
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.199.2.23 2003/08/09 16:47:21 iliaa Exp $ */
+/* $Id: array.c,v 1.199.2.24 2003/08/09 20:50:25 iliaa Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -1476,7 +1476,7 @@
 
        n_elems = zend_hash_num_elements(Z_ARRVAL_P(array));
        
-       if (n_elems <= 1) {
+       if (n_elems < 1) {
                return;
        }
 
@@ -2983,7 +2983,7 @@
 
        /* If all arrays are empty or have only one entry,
           we don't need to do anything. */
-       if (array_size <= 1) {
+       if (array_size < 1) {
                for (k = 0; k < MULTISORT_LAST; k++)
                        efree(ARRAYG(multisort_flags)[k]);
                efree(arrays);
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.335 php-src/NEWS:1.1247.2.336
--- php-src/NEWS:1.1247.2.335   Sat Aug  9 12:49:08 2003
+++ php-src/NEWS        Sat Aug  9 16:50:25 2003
@@ -7,6 +7,8 @@
 - Fixed bug #24977 (Revert mysql_select_db optimization). (Ilia)
 - Fixed bug #24909 (Bad random numbers with ZTS builds on Solaris). (Ilia)
 - Fixed bug #24951 (ob_flush() needlessly destroys output handler). (Ilia)
+- Fixed bug #24897 (inconsistent behavior of shuffle() & array_multisort()).
+  (Ilia, Jani)
 - Fixed bug #24792 (--enable-zend-multibyte causes random segfaults with ZTS).
   (fujimoto)
 - Fixed bug #24142 (workaround for a gcc bug affecting round()). (Marcus, Ilia)

Index: php-src/ext/standard/tests/array/bug24897.phpt
+++ php-src/ext/standard/tests/array/bug24897.phpt
--TEST--
Bug #24897 (inconsistent behaviour or shuffle() & array_multisort())
--FILE--
<?php
$a = array(1 => 2);
shuffle($a);
var_dump($a);

$a = array(1 => 2);
array_multisort($a);
var_dump($a);
?>
--EXPECT--
array(1) {
  [0]=>
  int(2)
}
array(1) {
  [0]=>
  int(2)
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to