diff options
author | AltamashShaikh <altamash@innocraft.com> | 2021-10-13 06:50:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-13 06:50:23 +0300 |
commit | 68674d8fdf1464e0342f8413372ae702e7b7bc43 (patch) | |
tree | f334fc35788b4481e0d158160a444c311b8fcae2 | |
parent | dc47c2dc90f6bb009512742c2a8ac5201865b3ca (diff) |
Fixed in place sorting order bug for PHP version >= 8 (#18131)
4 files changed, 9 insertions, 7 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; } diff --git a/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getGlossaryMetrics.xml b/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getGlossaryMetrics.xml index eb60447cfd..66482770da 100644 --- a/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getGlossaryMetrics.xml +++ b/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getGlossaryMetrics.xml @@ -157,12 +157,12 @@ </row> <row> <name>Pageviews</name> - <id>nb_pageviews</id> + <id>nb_hits</id> <documentation>The number of times this page was visited.</documentation> </row> <row> <name>Pageviews</name> - <id>nb_hits</id> + <id>nb_pageviews</id> <documentation>The number of times this page was visited.</documentation> </row> <row> diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_glossary.png b/tests/UI/expected-screenshots/UIIntegrationTest_glossary.png index d30965f9f2..8bb8814af3 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_glossary.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_glossary.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:846673e9f2b974e37fe864cfe920f4f3ba1c9e0bc5373c3139f9d8c1d06e7c5a +oid sha256:4f321b873633ff84532035123aa25ffb00d92f8c299ee21b3d75bc203bd72031 size 604651 diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_glossary_widgetized.png b/tests/UI/expected-screenshots/UIIntegrationTest_glossary_widgetized.png index d2a1cab7e8..ba5dc0f123 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_glossary_widgetized.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_glossary_widgetized.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9cc7c93bff1c5e0f7b75ab352dc8de15d51ee83c711aa9c3f564938de45e75ce -size 751559 +oid sha256:87a8e9807dfd8881aa63a79f61f20f0afd7bab18470bb01e3e87fbfff6957a35 +size 751553 |