iliaa Sat Aug 9 16:49:00 2003 EDT
Added files:
/php-src/ext/standard/tests/array bug24897.phpt
Modified files:
/php-src/ext/standard array.c
Log:
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.240 php-src/ext/standard/array.c:1.241
--- php-src/ext/standard/array.c:1.240 Sat Aug 9 12:43:28 2003
+++ php-src/ext/standard/array.c Sat Aug 9 16:48:59 2003
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.240 2003/08/09 16:43:28 iliaa Exp $ */
+/* $Id: array.c,v 1.241 2003/08/09 20:48:59 iliaa Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -1639,7 +1639,7 @@
n_elems = zend_hash_num_elements(Z_ARRVAL_P(array));
- if (n_elems <= 1) {
+ if (n_elems < 1) {
return;
}
@@ -3150,7 +3150,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/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