Issue Bug Closed

#17861Extension Manager does not sort versions of an extension correctly

Micha Barthel 11/28/07, 21:14 updated 10/02/18, 12:32

Description

This list not sorted!
$versions = array_keys($this->xmlhandler->extensionsXML[$extKey][‘versions’]);
$latestVersion = end($versions);

On line: 1610,1735,1382……

User this sort Function from Elmar Hinz:

Own
————————————————————————
————————————————————————
Sort:
————————————————————————
usort($versions, array(‘SC_mod_tools_em_index’, ‘compare’));
————————————————————————
————————————————————————
Function:
————————————————————————
function compare($aIn, $bIn) {
$aParts = explode(‘.’, $aIn, 2);
$bParts = explode(‘.’, $bIn, 2);
$a = (int) $aParts0;
$b = (int) $bParts0;
if($a > $b){
return 1;
}elseif($a < $b){
return -1;
} else {
if(is_string($aParts1)) {
return SC_mod_tools_em_index::compare($aParts1, $bParts1);
} else {
return 0;
}
}
}
————————————————————————
————————————————————————

regards Micha Barthel

(issue imported from #M6854)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.