mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
Protect against non existing reconciliation keys...
SVN:trunk[2788]
This commit is contained in:
@@ -1557,31 +1557,34 @@ class MFElement extends DOMElement
|
|||||||
$aRanks = array();
|
$aRanks = array();
|
||||||
foreach($oItems->childNodes as $oItem)
|
foreach($oItems->childNodes as $oItem)
|
||||||
{
|
{
|
||||||
// When an attribute is missing
|
if ($oItem instanceof DOMElement)
|
||||||
if ($oItem->hasAttribute('id'))
|
|
||||||
{
|
{
|
||||||
$key = $oItem->getAttribute('id');
|
// When an attribute is missing
|
||||||
if (array_key_exists($key, $res))
|
if ($oItem->hasAttribute('id'))
|
||||||
{
|
{
|
||||||
// Houston!
|
$key = $oItem->getAttribute('id');
|
||||||
throw new DOMFormatException("Tag ".$oItem->getNodePath().", id '$key' already used!!!");
|
if (array_key_exists($key, $res))
|
||||||
|
{
|
||||||
|
// Houston!
|
||||||
|
throw new DOMFormatException("Tag ".$oItem->getNodePath().", id '$key' already used!!!");
|
||||||
|
}
|
||||||
|
$res[$key] = $oItem->GetNodeAsArrayOfItems();
|
||||||
}
|
}
|
||||||
$res[$key] = $oItem->GetNodeAsArrayOfItems();
|
else
|
||||||
|
{
|
||||||
|
$res[] = $oItem->GetNodeAsArrayOfItems();
|
||||||
|
}
|
||||||
|
$sRank = $oItem->GetChildText('rank');
|
||||||
|
if ($sRank != '')
|
||||||
|
{
|
||||||
|
$aRanks[] = (float) $sRank;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$aRanks[] = count($aRanks) > 0 ? max($aRanks) + 1 : 0;
|
||||||
|
}
|
||||||
|
array_multisort($aRanks, $res);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$res[] = $oItem->GetNodeAsArrayOfItems();
|
|
||||||
}
|
|
||||||
$sRank = $oItem->GetChildText('rank');
|
|
||||||
if ($sRank != '')
|
|
||||||
{
|
|
||||||
$aRanks[] = (float) $sRank;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$aRanks[] = count($aRanks) > 0 ? max($aRanks) + 1 : 0;
|
|
||||||
}
|
|
||||||
array_multisort($aRanks, $res);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user