@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

Context

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 🤔

Powered by GitHub Issue Mirror