Why "Invalid idSite: '0'" is PHP error?


#1

I periodically check site logs and see about ~400 errors per month like this: “Error in Matomo (tracker): Invalid idSite: ‘0’”.
I investigated the problem. It is somehow connected with UCBrowser V7.0.185.1002. The first visit from this browser generates a very strange request to piwik.php. But it is not a problem.

My question is: Why “Invalid idSite: ‘0’” is written to PHP error log at all? It is not a software problem. It is not an error. I think some bots can try to generate requests with wrong site IDs or without it at all.
It floods PHP error log and I can occasionally miss some real error.

I plan to modify \core\Tracker\Response.php

public function outputException(…)
{
Common::sendResponseCode($statusCode);
+++ if ($statusCode == 500)
$this->logExceptionToErrorLog($e);

but it is not a good solution because I should restore it after updates.

Is it possible (or planned) to make logs more versatile?