From: trucall at gmail dot com
Operating system: linux 2.6.12-10-686
PHP version: 5.1.2
PHP Bug Type: Arrays related
Bug description: array_multisort : Array sizes are inconsistent
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 bug report at http://bugs.php.net/?id=36633&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=36633&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=36633&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=36633&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36633&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=36633&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36633&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36633&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36633&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36633&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36633&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=36633&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=36633&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36633&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36633&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36633&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36633&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36633&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36633&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36633&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36633&r=mysqlcfg