ID:               36633
 Updated by:       [EMAIL PROTECTED]
 Reported By:      trucall at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: linux 2.6.12-10-686
 PHP Version:      5.1.2
 New Comment:

They _are_ inconsistent: add var_dump($volume); before the second
array_multisort() and you'll see it.


Previous Comments:
------------------------------------------------------------------------

[2006-03-06 19:00:07] trucall at gmail dot com

Description:
------------
I'm not sure is a bug but I don't understand why the first block is
executed correctly whereas the second one (same code) returns with this
warning:

Warning: array_multisort() [function.array-multisort]: Array sizes are
inconsistent in /usr/local/httpd-2.2.0/htdocs/test/multisort.php on
line 27

Reproduce code:
---------------
<?
error_reporting(E_ALL);

// first block 
$data = array();

$data[2] = array('volume' => 67, 'edition' => 2);
$data[3] = array('volume' => 86, 'edition' => 1);

foreach ($data as $key => $row) {
   $volume[$key]  = $row['volume'];
   $edition[$key] = $row['edition'];
}

array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data);

// second block (equal to first block)
$data = array();

$data[2] = array('volume' => 67, 'edition' => 2);
$data[3] = array('volume' => 86, 'edition' => 1);

foreach ($data as $key => $row) {
   $volume[$key]  = $row['volume'];
   $edition[$key] = $row['edition'];
}

array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data);

?>

Expected result:
----------------
Both blocks give the same result.




Actual result:
--------------
Warning: array_multisort() [function.array-multisort]: Array sizes are
inconsistent in /usr/local/httpd-2.2.0/htdocs/test/multisort.php on
line 27


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36633&edit=1

Reply via email to