Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2014-01-09 02:15:44 +0400
committermattab <matthieu.aubry@gmail.com>2014-01-09 02:15:44 +0400
commit23a1c9d680a2409c182977cc02ebf1c00d414cd0 (patch)
tree22e1ffe47323d875b3f312e30ca999cf777d9b97 /core/DataTable.php
parent524cc8eb0d7c983b567c11b2cf1b22cac45c6d78 (diff)
Fixes #4491 Prevent Random error by catching the Exception in case the subtable is not found.
Adding test that reproduced the issue and then shows it's fixed.
Diffstat (limited to 'core/DataTable.php')
-rw-r--r--core/DataTable.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/DataTable.php b/core/DataTable.php
index aa97941971..dcbe390e17 100644
--- a/core/DataTable.php
+++ b/core/DataTable.php
@@ -20,6 +20,7 @@ use Piwik\DataTable\Renderer\Html;
use Piwik\DataTable\Row;
use Piwik\DataTable\Row\DataTableSummaryRow;
use Piwik\DataTable\Simple;
+use Piwik\DataTable\TableNotFoundException;
use ReflectionClass;
/**
@@ -315,7 +316,7 @@ class DataTable implements DataTableInterface
public function __construct()
{
// registers this instance to the manager
- $this->currentId = Manager::getInstance()->addTable($this);
+ $this->currentId = Manager::getInstance()-> addTable($this);
}
/**
@@ -1102,7 +1103,16 @@ class DataTable implements DataTableInterface
$aSerializedDataTable = array();
foreach ($this->rows as $row) {
if (($idSubTable = $row->getIdSubDataTable()) !== null) {
- $subTable = Manager::getInstance()->getTable($idSubTable);
+ $subTable = null;
+ try {
+ $subTable = Manager::getInstance()->getTable($idSubTable);
+ } catch(TableNotFoundException $e) {
+ // This occurs is an unknown & random data issue. Catch Exception and remove subtable from the row.
+ $row->removeSubtable();
+ // Go to next row
+ continue;
+ }
+
$depth++;
$aSerializedDataTable = $aSerializedDataTable + $subTable->getSerialized($maximumRowsInSubDataTable, $maximumRowsInSubDataTable, $columnToSortByBeforeTruncation);
$depth--;