@jenger opened this Issue on December 28th 2022

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.

Behavior

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;
        }

Expected Behavior

Piwik::hasUserSuperUserAccess() should not return true in this context.
Why does it work with php7.4?

Possible Solution

I skipped the Piwik::hasUserSuperUserAccess() section -> login works.

My Environment

  • Matomo Version: 4.13.0
  • PHP Version: 8.1.13
  • Server Operating System: Linux/Ubuntu 5.4.0-135-generic
  • Webserver: nginx 1.22.1
  • Browser: Firefox 108.0.1
@bx80 commented on January 4th 2023 Contributor

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?

Powered by GitHub Issue Mirror