Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matomo 4.5 not working with PHP 8.1 RC3 (Matomo 4.4.1 worked fine) #18117

Closed
Nico-de-Vries opened this issue Oct 8, 2021 · 7 comments · Fixed by #18309
Closed

Matomo 4.5 not working with PHP 8.1 RC3 (Matomo 4.4.1 worked fine) #18117

Nico-de-Vries opened this issue Oct 8, 2021 · 7 comments · Fixed by #18309
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Milestone

Comments

@Nico-de-Vries
Copy link

Nico-de-Vries commented Oct 8, 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.

PROBLEM:

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()

WORKAROUND:

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

@Findus23 Findus23 added this to the 4.6.0 milestone Oct 8, 2021
@Findus23
Copy link
Member

Findus23 commented Oct 8, 2021

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 #17686, but it seems like this hasn't been seen yet (maybe because I tested with Matomo 4.4.1)

@Findus23 Findus23 added the Bug For errors / faults / flaws / inconsistencies etc. label Oct 8, 2021
@Findus23
Copy link
Member

Findus23 commented Oct 8, 2021

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
Copy link
Member

Findus23 commented Oct 8, 2021

It still seems to work for me:
grafik

Maybe @diosmosis has an idea as #17736 is the only change I know in Matomo 4.5.0 related to those files.

@diosmosis
Copy link
Member

diosmosis commented Oct 9, 2021

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
Copy link
Member

tsteur commented Oct 10, 2021

Was thinking if maybe #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
Copy link
Member

tsteur commented Oct 10, 2021

This would be ideally worked on by the same people that do #17686

@tsteur tsteur added the Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. label Nov 2, 2021
@MichaIng
Copy link
Contributor

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:

* @return Traversable

for the public function getIterator() does it?

@sgiehl sgiehl self-assigned this Nov 14, 2021
@justinvelluppillai justinvelluppillai added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants