Hi Team,
Am getting below error in the error log. Please help me to resolve this
[2021-06-04 06:41:13 UTC] [84a06] E:\Project\matomo\core\Profiler.php(80): Deprecated - uasort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero - Matomo 4.2.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) [internal function]: Piwik\ErrorHandler::errorHandler(),#1 \core\Profiler.php(80),#2 \core\FrontController.php(229),[internal function]: Piwik\FrontController->__destruct()
Lukas
(Lukas Winkler)
June 4, 2021, 8:23am
2
Hi,
Just to keep in mind that you should not have enabled enable_sql_profiler = 1
in production except for testing performance issues.
Nevertheless, this looks like a bug and should be fixed with
matomo-org:4.x-dev
← matomo-org:fix-sql-profiler-sort
opened 08:22AM - 04 Jun 21 UTC
reported in https://forum.matomo.org/t/deprecated-uasort-returning-bool-from-com… parison-function-is-deprecated-return-an-integer-less-than-equal-to-or-greater-than-zero-matomo-4-2-1/42125
> core\Profiler.php(80): Deprecated - uasort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero
I didn't test this, but the fix seems obvious from https://www.php.net/manual/en/function.uasort.php
### Review
* [ ] Functional review done
* [ ] Potential edge cases thought about (behavior of the code with strange input, with strange internal state or possible interactions with other Matomo subsystems)
* [ ] Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
* [ ] Security review done [see checklist](https://developer.matomo.org/guides/security-in-piwik#checklist)
* [ ] Code review done
* [ ] Tests were added if useful/possible
* [ ] Reviewed for breaking changes
* [ ] Developer changelog updated if needed
* [ ] Documentation added if needed
* [ ] Existing documentation updated if needed
Thanks Lukas for your prompt reply.
Now what i am suppose to do from this github link ?
Regards,
Paresh Badgujar
Lukas
(Lukas Winkler)
June 4, 2021, 8:51am
4
Hi,
Either wait until it is merged and the fix is included in the next Matomo release.
Or if you can’t wait and want to try it out (I haven’t tested it), apply these changes to the core/Profiler.php
file:
diff --git a/core/Profiler.php b/core/Profiler.php
index 1f69c242662..4b21ddc8035 100644
--- a/core/Profiler.php
+++ b/core/Profiler.php
@@ -100,12 +100,18 @@ public static function displayDbProfileReport()
private static function maxSumMsFirst($a, $b)
{
- return $a['sum_time_ms'] < $b['sum_time_ms'];
+ if ($a['sum_time_ms'] == $b['sum_time_ms']) {
+ return 0;
+ }
+ return ($a['sum_time_ms'] < $b['sum_time_ms']) ? -1 : 1;
}
private static function sortTimeDesc($a, $b)
{
- return $a['sumTimeMs'] < $b['sumTimeMs'];
+ if ($a['sumTimeMs'] == $b['sumTimeMs']) {
+ return 0;
+ }
+ return ($a['sumTimeMs'] < $b['sumTimeMs']) ? -1 : 1;
}
/**
(as in replace the red lines with the green lines (without the - and +))