@mattmary opened this Issue on June 14th 2022 Contributor

there is a deprecated warning on php8.1 for a variable is null and should be a string

Expected Behavior

No warning displayed when displaying the system report page within the wordpress plugin.

Current Behavior

Screenshot from 2022-06-14 13-11-09
A warning is displayed when running with php8.1 the system report page

Possible Solution

define the $piwik_minimumPHPVersion variable as global in the app/core/testMinimumPhpVersion.php solves this issue.

Steps to Reproduce (for Bugs)

1.install the wordpress plugin
2.switch to php8.1 version for your apache
3.open the wp-admin/admin.php?page=matomo-systemreport url
4.views the warning
5.add global $piwik_minimumPHPVersion; in line 25 of the app/core/testMinimumPhpVersion.php

  1. refresh the page
  2. see the warning message has disappeared


Your Environment

  • Matomo Version: 4.10.0
  • PHP Version: 8.1.7
  • Server Operating System: Apache 2.4
  • Additionally installed plugins:
  • Browser:
  • Operating System:
@mattmary commented on June 14th 2022 Contributor

another related warning

Deprecated: version_compare(): Passing null to parameter #1 ($version1) of type string is deprecated in app/core/CliMulti/CliPhp.php on line 76

@sgiehl commented on June 14th 2022 Member

@mattmary I'm not seeing this error when using Matomo the "normal" way on PHP 8.1.

@mattmary commented on June 14th 2022 Contributor

@sgiehl when you say the normal way is matomo on premise?

@mattmary commented on June 14th 2022 Contributor
@sgiehl commented on June 14th 2022 Member

Yes. On premise

@mattmary commented on June 14th 2022 Contributor

in php8.1 @sgiehl ?

@sgiehl commented on June 14th 2022 Member

tested it with 8.1.5

@mattmary commented on June 16th 2022 Contributor

hi @sgiehl

I've tried different ways to fix this issue. the only one which work is to define as global the variable $piwik_minimumPHPVersion in this file. which impact would it have to do so?

@sgiehl commented on June 16th 2022 Member

That variable actually should be global. But maybe that isn't the case as WordPress includes Matomo 🤔

@justinvelluppillai commented on July 6th 2022 Member

@sgiehl yes it looks like due to the way wordpress is including matomo it needs a workaround here. Any advice on whether we can apply @mattmary 's fix to core would be appreciated, or alternative ways to work around so he doesn't have to make this change every release for wordpress.

@sgiehl commented on July 6th 2022 Member

@justinvelluppillai I don't have Matomo for Wordpress set up, so I'm not able to say if there would a smarter solution. But adding a global keyword should not produce any problems I guess.

@sgiehl commented on November 9th 2022 Member

@mattmary Is this something we still need to change in core, or is the fix for wordpress a suitable solution and we can close this one?

@mattmary commented on November 13th 2022 Contributor

@sgiehl Sure I can fix it, but I'll have to do it each time we publish a new release. It would be definitively better if you could update the core.

@sgiehl commented on November 15th 2022 Member

@mattmary Would you mind creating a pull request for core?

@mattmary commented on November 18th 2022 Contributor

Hum @sgiehl

Now with the latest branch release, I've some fatal errors:
Screenshot from 2022-11-18 13-50-38
I guess I'll have to fix these updates first when we'll deploy the 4.13 release.

So I would suggest postponing this fix in the release after the 4.13.

Powered by GitHub Issue Mirror