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:
authorAltamashShaikh <altamash@innocraft.com>2021-10-13 06:50:23 +0300
committerGitHub <noreply@github.com>2021-10-13 06:50:23 +0300
commit68674d8fdf1464e0342f8413372ae702e7b7bc43 (patch)
treef334fc35788b4481e0d158160a444c311b8fcae2 /plugins/API
parentdc47c2dc90f6bb009512742c2a8ac5201865b3ca (diff)
Fixed in place sorting order bug for PHP version >= 8 (#18131)
Diffstat (limited to 'plugins/API')
-rw-r--r--plugins/API/Glossary.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/API/Glossary.php b/plugins/API/Glossary.php
index 144fcd4389..d76dcfdaa2 100644
--- a/plugins/API/Glossary.php
+++ b/plugins/API/Glossary.php
@@ -119,9 +119,11 @@ class Glossary
);
}
}
-
+
usort($metrics, function ($a, $b) {
- return strcmp($a['name'], $b['name']);
+ $key = ($a['name'] === $b['name'] ? 'id' : 'name');
+
+ return strcmp($a[$key], $b[$key]);
});
return $metrics;
}