php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37210 array_multisort reports inconsistent warning when arrays are consistent
Submitted: 2006-04-26 16:39 UTC Modified: 2006-04-26 16:52 UTC
From: mattsch at gmail dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.1.2 OS: Linux
Private report: No CVE-ID: None
 [2006-04-26 16:39 UTC] mattsch at gmail dot com
Description:
------------
array_multisort reports this warning on arrays in which the sizes are consistent:

Warning: array_multisort() [function.array-multisort]: Array sizes are inconsistent in /home/www/rootsite_staging/reports/index.php on line

Reproduce code:
---------------
<?php
$selectedReports = array (
  'file' =>
  array (
    0 => '/home/www/staging/reports/Daily Reports/DMR/2006/04_April2006/20060417_DAY.xls',
    1 => '/home/www/staging/reports/Daily Reports/Payroll/2006/04_April2006/20060417_DailyPayroll.xls',
    2 => '/home/www/staging/reports/Daily Reports/DMR/2006/04_April2006/20060418_DAY.xls',
    3 => '/home/www/staging/reports/Daily Reports/Payroll/2006/04_April2006/20060418_DailyPayroll.xls',
    4 => '/home/www/staging/reports/Daily Reports/DMR/2006/04_April2006/20060419_DAY.xls',
    5 => '/home/www/staging/reports/Daily Reports/Payroll/2006/04_April2006/20060419_DailyPayroll.xls',
    6 => '/home/www/staging/reports/Daily Reports/DMR/2006/04_April2006/20060420_DAY.xls',
    7 => '/home/www/staging/reports/Daily Reports/DMR/2006/04_April2006/20060420_DAY_r1.xls',
    8 => '/home/www/staging/reports/Daily Reports/Payroll/2006/04_April2006/20060420_DailyPayroll.xls',
    9 => '/home/www/staging/reports/Daily Reports/Payroll/2006/04_April2006/20060420_DailyPayroll_r1.xls',
    10 => '/home/www/staging/reports/Daily Reports/DMR/2006/04_April2006/20060421_DAY.xls',
  ),
  'date' =>
  array (
    0 => '2006-04-17',
    1 => '2006-04-17',
    2 => '2006-04-18',
    3 => '2006-04-18',
    4 => '2006-04-19',
    5 => '2006-04-19',
    6 => '2006-04-20',
    7 => '2006-04-20',
    8 => '2006-04-20',
    9 => '2006-04-20',
    10 => '2006-04-21',
  ),
  'revision' =>
  array (
    0 => 0,
    1 => 0,
    2 => 0,
    3 => 0,
    4 => 0,
    5 => 0,
    6 => 0,
    7 => 1,
    8 => 0,
    9 => 1,
    10 => 0,
  ),
  'report' =>
  array (
    0 => 'Daily Manager Report',
    1 => 'Payroll Report',
    2 => 'Daily Manager Report',
    3 => 'Payroll Report',
    4 => 'Daily Manager Report',
    5 => 'Payroll Report',
    6 => 'Daily Manager Report',
    7 => 'Daily Manager Report',
    8 => 'Payroll Report',
    9 => 'Payroll Report',
    10 => 'Daily Manager Report',
  ),
);
array_multisort($selectedReports['date'], $selectedReports['report'], $selectedReports['revision'], SORT_DESC, $selectedReports['file'], $selectedReports);
?>

Expected result:
----------------
The size of each dimension dimension being sorted are consistent.  I've checked it and rechecked it and even looped over it (no index error). It should not report an inconsistent warning. 

Actual result:
--------------
Does not sort and reports an inconsistent size warning.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-26 16:52 UTC] mattsch at gmail dot com
Sorry, this is bogus.  I know what I'm doing wrong.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 07:01:27 2024 UTC