Skip to content
Extraits de code Groupes Projets
Valider 3b6066c7 rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

Check for valid data in RowEvolution API to avoid unexpected fatal errors.

parent a94b3d49
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -360,9 +360,16 @@ class RowEvolution ...@@ -360,9 +360,16 @@ class RowEvolution
unset($metadata['logos']); unset($metadata['logos']);
$subDataTables = $dataTable->getDataTables(); $subDataTables = $dataTable->getDataTables();
if (empty($subDataTables)) {
throw new \Exception("Unexpected state: row evolution API call returned empty DataTable\\Map.");
}
$firstDataTable = reset($subDataTables); $firstDataTable = reset($subDataTables);
$this->checkDataTableInstance($firstDataTable);
$firstDataTableRow = $firstDataTable->getFirstRow(); $firstDataTableRow = $firstDataTable->getFirstRow();
$lastDataTable = end($subDataTables); $lastDataTable = end($subDataTables);
$this->checkDataTableInstance($lastDataTable);
$lastDataTableRow = $lastDataTable->getFirstRow(); $lastDataTableRow = $lastDataTable->getFirstRow();
// Process min/max values // Process min/max values
...@@ -533,4 +540,11 @@ class RowEvolution ...@@ -533,4 +540,11 @@ class RowEvolution
$label = SafeDecodeLabel::decodeLabelSafe($label); $label = SafeDecodeLabel::decodeLabelSafe($label);
return $label; return $label;
} }
private function checkDataTableInstance($lastDataTable)
{
if (!($lastDataTable instanceof DataTable)) {
throw new \Exception("Unexpected state: row evolution returned DataTable\\Map w/ incorrect child table type: " . get_class($lastDataTable));
}
}
} }
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter