@Nico-de-Vries opened this Issue on October 8th 2021

I understand PHP 8.1 RC3 is not officially supported yet but decided to report this anyway. It worked fine with 4.4.1 until I upgraded to 4.5. Unfortunately downgrade doesn't work (database has already been upgraded) so I did some debugging to figure out a workaround.

I tripple checked that Matomo 4.5 was properly installed with a diff -qr between the zip and my installation.


PHP Fatal error: During inheritance of IteratorAggregate: Uncaught Error: Class "Piwik\Session\SessionNamespace" not found in /var/www/.../core/Notification/Manager.php:203 Stack trace:#0 /var/www/.../core/Notification/Manager.php(147): Piwik\Notification\Manager::getSession()


File: /var/www/.../plugins/Monolog/Handler/WebNotificationHandler.php
Comment out: Manager::notify(Common::getRandomString(), $notification);

@Findus23 commented on October 8th 2021 Member

Indeed PHP 8.1 is not yet supported, but thanks for reporting the issue, that way we can get it working until it releases.

We are tracking all issues in https://github.com/matomo-org/matomo/issues/17686, but it seems like this hasn't been seen yet (maybe because I tested with Matomo 4.4.1)

@Findus23 commented on October 8th 2021 Member

Weirdly enough Matomo 4.5.0 is working fine for me in PHP 8.1.0beta2. I'll compile the latest release candidate and check again.

@Findus23 commented on October 8th 2021 Member

It still seems to work for me:

Maybe @diosmosis has an idea as https://github.com/matomo-org/matomo/pull/17736 is the only change I know in Matomo 4.5.0 related to those files.

@diosmosis commented on October 9th 2021 Member

This seems like it might be a PHP issue... IteratorAggregate is an interface, nothing should inherit from it (just implement it). It also seems like this error might be covering up some other error. It might help to just print, log or file_put_contents the notification message in WebNotificationHandler to see what Matomo is trying to display.

@tsteur commented on October 10th 2021 Member

Was thinking if maybe https://github.com/matomo-org/matomo/pull/17989 regressed something there but doesn't seem to reference IteratorAggregate. Possible that PHP8.1 issue has always been there but not noticed if there was no notification triggered.

Possibly what happened in Matomo 4.5 is what @diosmosis suggested there's now a notice or warning or something that wasn't triggered before. Like eg if using IE11 or something and this now triggers the PHP 8.1 error but the error itself has been there in Matomo 4.4.

We might be able to reproduce it by triggering a warning there ourselves using PHP 8.1

@tsteur commented on October 10th 2021 Member

This would be ideally worked on by the same people that do https://github.com/matomo-org/matomo/issues/17686

@MichaIng commented on November 13th 2021

Another one:

PHP message: PHP Deprecated:  Return type of HTML_QuickForm2_Container::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/matomo/libs/HTML/QuickForm2/Container.php on line 326

As it implements: https://www.php.net/manual/en/class.iteratoraggregate.php

Probably setting:

* <a class='mention' href='https://github.com/return'>@return</a> Traversable

for the public function getIterator() does it?

This Issue was closed on November 15th 2021
Powered by GitHub Issue Mirror