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:
Diffstat (limited to 'core/DataAccess/LogQueryBuilder/JoinTables.php')
-rw-r--r--core/DataAccess/LogQueryBuilder/JoinTables.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/DataAccess/LogQueryBuilder/JoinTables.php b/core/DataAccess/LogQueryBuilder/JoinTables.php
index d840cfba3f..1faad323a7 100644
--- a/core/DataAccess/LogQueryBuilder/JoinTables.php
+++ b/core/DataAccess/LogQueryBuilder/JoinTables.php
@@ -97,7 +97,17 @@ class JoinTables extends \ArrayObject
// we need to make sure first table always comes first, only sort tables after the first table
$firstTable = array_shift($tables);
- usort($tables, $cmpFunction);
+ usort($tables, function ($ta, $tb) use ($tables, $cmpFunction) {
+ $return = call_user_func($cmpFunction, $ta, $tb);
+ if ($return === 0) {
+ $indexA = array_search($ta, $tables);
+ $indexB = array_search($tb, $tables);
+
+ return $indexA - $indexB;
+ }
+
+ return $return;
+ });
array_unshift($tables, $firstTable);
$this->exchangeArray($tables);