Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002014 [Quercus] major sometimes 09-15-07 17:26 09-18-07 10:39
Reporter hendler View Status public  
Assigned To nam
Priority normal Resolution fixed  
Status closed   Product Version 3.1.2
Summary 0002014: array_multisort with main key being non-numeric exhibts odd behavior
Description doesn't work in quercus, but works in PHP 5.2

 $array_name = array();
 $array['n']['x'] = 123;
 $array['n']['z'] = 123123;
 $array['b']['x'] = 123;
 $array['b']['z'] = 234;
 $array['g']['x'] = 123;
 $array['g']['z'] = 1;
 
 $count_name = 'count';
 ${$count_name} = array();
 foreach ($array as $key => $row) {
    ${$count_name}[$key] = $row['z'];
}
                
                //
eval( ' array_multisort($count,SORT_ASC,SORT_NUMERIC,$array); print_r($array);');
Additional Information

WORKS:

 $array = array();
 $array[0]['x'] = 123;
 $array[0]['z'] = 123123;
 $array[1]['x'] = 123;
 $array[1]['z'] = 234;
 $array[2]['x'] = 123;
 $array[2]['z'] = 1;
 
 
 foreach ($array as $key => $row) {
    $count[$key] = $row['z'];
}
                
                //
eval( ' array_multisort($count,SORT_ASC,SORT_NUMERIC,$array); print_r($array);');

as does
 $array_name = array();
 $array[0]['x'] = 123;
 $array[0]['z'] = 123123;
 $array[1]['x'] = 123;
 $array[1]['z'] = 234;
 $array[2]['x'] = 123;
 $array[2]['z'] = 1;
 
 $count_name = 'count';
 ${$count_name} = array();
 foreach ($array as $key => $row) {
    ${$count_name}[$key] = $row['z'];
}
                
                //
eval( ' array_multisort($count,SORT_ASC,SORT_NUMERIC,$array); print_r($array);');
Attached Files

- Relationships

- Notes
(0002295)
hendler
09-15-07 17:31

quick note:

the result array remains the same
and the counting array is doubled in length with replicated values but lost keys.
 
(0002300)
nam
09-18-07 10:39

php/175t
 

- Issue History
Date Modified Username Field Change
09-15-07 17:26 hendler New Issue
09-15-07 17:31 hendler Note Added: 0002295
09-17-07 12:20 nam Status new => assigned
09-17-07 12:20 nam Assigned To  => nam
09-18-07 10:39 nam Status assigned => closed
09-18-07 10:39 nam Note Added: 0002300
09-18-07 10:39 nam Resolution open => fixed
09-18-07 10:39 nam Fixed in Version  => 3.1.3


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker