After changing from php version 7.4.33 to 8.1.13, matomo users with "Superuser access" right can not login any more
For all other user's with lower rights, login still works.
A matomo error banner is displayed to the user:
"Error: no website was found in this Matomo installation.
Check the table '$siteTableName' in your database, it should contain your Matomo websites."
In the code at
Plugin/Controller.php line 956 Piwik::hasUserSuperUserAccess()
block is entered and throws the exception.
public function redirectToIndex($moduleToRedirect, $actionToRedirect, $websiteId = null, $defaultPeriod = null,
$defaultDate = null, $parameters = array())
....
if (Piwik::hasUserSuperUserAccess()) {
$siteTableName = Common::prefixTable('site');
$message = "Error: no website was found in this Matomo installation.
<br />Check the table '$siteTableName' in your database, it should contain your Matomo websites.";
$ex = new NoWebsiteFoundException($message);
$ex->setIsHtmlMessage();
throw $ex;
}
Piwik::hasUserSuperUserAccess() should not return true in this context.
Why does it work with php7.4?
I skipped the Piwik::hasUserSuperUserAccess() section -> login works.
Hi @jenger, thanks for reporting this.
I've tested Matomo 4.13 superuser login with PHP 8.1.13 and Piwik::hasUserSuperUserAccess()
returns false during login as expected.
There are differences in boolean comparison between PHP 7.x and 8.x which could potentially cause this behaviour (https://www.php.net/manual/en/migration80.incompatible.php) but Matomo has been PHP8 compatible for quite a while now and I'm not aware of any related issues with superuser login.
Could you provide a list of the plugins you are using?