@Findus23 opened this Issue on June 12th 2022 Member

The first alpha of PHP 8.2 has been released and I got a bit of time, so I will be looking into what the major things are that will cause current Matomo to break when using PHP 8.2.
See also #17686 for 8.1

Reading through UPGRADING, I don't see any major breaking changes, but we will see what needs to be changed.

As only the first reported issue here seems to completely brake Matomo and with it fixed, the majority of Matomo is already working fine, I will only list one example per deprecated usage here and link to more information about the deprecation.


Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /home/lukas/public_html/matomophp8/core/testMinimumPhpVersion.php on line 130

See https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation

https://github.com/matomo-org/matomo/pull/19344 (there are also a few more occurances in tests)


WARNING [2022-06-12 15:26:34] 188990 /home/lukas/public_html/matomophp8/plugins/PrivacyManager/DoNotTrackHeaderChecker.php(29): Deprecated - Creation of dynamic property Piwik\Plugins\PrivacyManager\DoNotTrackHeaderChecker::$config is deprecated - Matomo 4.11.0-rc1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)

I assume this will affect a lot of code, but also it should be really easy to detect with PHPStorm or PHP_CS:
https://wiki.php.net/rfc/deprecate_dynamic_properties
https://php.watch/versions/8.2/dynamic-properties-deprecated
https://github.com/squizlabs/PHP_CodeSniffer/issues/3489

And getting rid of such cases might make the code more readable and especially avoid bugs because of typos.


WARNING [2022-06-12 15:26:35] 188990 /home/lukas/public_html/matomophp8/core/Console.php(135): Deprecated - Callables of the form ["Piwik\Console", "Symfony\Component\Console\Application::doRun"] are deprecated - Matomo 4.11.0-rc1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
https://github.com/matomo-org/matomo/blob/e3218471244d08039b1b84f1c907f1be0e018768/core/Console.php#L135

https://wiki.php.net/rfc/deprecate_partially_supported_callables
https://php.watch/versions/8.2/partially-supported-callable-deprecation


To be updated...

@utrautmann commented on August 29th 2022

Here is a list of additional warnings for Matomo with PHP8.2.

  1. WARNING: /core/Cookie.php(92): Deprecated - Creation of dynamic property Piwik\Cookie::$keyStore is deprecated - Matomo 4.11.0 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) (Module: CoreAdminHome, Action: home, In CLI mode: false)
  2. WARNING: /plugins/CustomDimensions/GetCustomDimension.php(201): Deprecated - Creation of dynamic property Piwik\Plugins\CustomDimensions\GetCustomDimension::$menuTitle is deprecated - Matomo 4.11.0 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) (Module: CoreAdminHome, Action: home, In CLI mode: false)
  3. WARNING: /plugins/CustomDimensions/GetCustomDimension.php(202): Deprecated - Creation of dynamic property Piwik\Plugins\CustomDimensions\GetCustomDimension::$widgetTitle is deprecated - Matomo 4.11.0 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) (Module: CoreAdminHome, Action: home, In CLI mode: false)
  4. WARNING: /plugins/CustomDimensions/Dimension/CustomActionDimension.php(23): Deprecated - Creation of dynamic property Piwik\Plugins\CustomDimensions\Dimension\CustomActionDimension::$actualName is deprecated - Matomo 4.11.0 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) (Module: CoreAdminHome, Action: home, In CLI mode: false)
  5. WARNING: /plugins/CustomDimensions/Dimension/CustomActionDimension.php(25): Deprecated - Creation of dynamic property Piwik\Plugins\CustomDimensions\Dimension\CustomActionDimension::$idDimension is deprecated - Matomo 4.11.0 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) (Module: CoreAdminHome, Action: home, In CLI mode: false)
  6. WARNING: /core/AssetManager/UIAssetMerger.php(183): Deprecated - Creation of dynamic property Piwik\AssetManager\UIAssetMerger\StylesheetUIAssetMerger::$cacheBusterValue is deprecated - Matomo 4.11.0 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) (Module: Proxy, Action: getCss, In CLI mode: false)
@sgiehl commented on August 29th 2022 Member

@utrautmann Thanks for reporting those. I've created https://github.com/matomo-org/matomo/pull/19690 to fix all of them in the next release.

@JEAholding commented on October 27th 2022

Here is a list of additional warnings from latest Matomo with PHP8.2 & 4.12.2

  • [x] WARNING: /plugins/PrivacyManager/DoNotTrackHeaderChecker.php(29): Deprecated - Creation of dynamic property Piwik\Plugins\PrivacyManager\DoNotTrackHeaderChecker::$config is deprecated - Matomo 4.12.2 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) (Module: UsersManager, Action: index, In CLI mode: false) = I GET this error essentially in all main menu options the only thing that changes is the Module / Location.

  • [x] WARNING: /core/Concurrency/Lock.php(95): Deprecated - Creation of dynamic property Piwik\Concurrency\Lock::$ttlUsed is deprecated - Matomo 4.12.2 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) (Module: Marketplace, Action: overview, In CLI mode: false)

@sgiehl commented on October 27th 2022 Member

thanks @JEAholding for reporting those. I'll prepare a PR to fix them.

@JEAholding commented on October 27th 2022

New warning on the new upgraded head.... PHP8.2 & 4.12.3....

1.WARNING: /core/Segment/SegmentExpression.php(59): Deprecated - Creation of dynamic property Piwik\Segment\SegmentExpression::$string is deprecated - Matomo 4.12.3 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) (Module: Live, Action: getLastVisitsStart, Method: Live.getLastVisitsDetails, In CLI mode: false)

@sgiehl commented on October 28th 2022 Member

@JEAholding Added a fix for that to the other PR

@justinvelluppillai commented on October 31st 2022 Member

Here are a few more:

  • [x] WARNING [2022-10-27 04:00:03] 21867 /var/www/html/piwik/core/ArchiveProcessor/Loader.php(70): Deprecated - Creation of dynamic property Piwik\ArchiveProcessor\Loader::$invalidateBeforeArchiving is deprecated
    --> https://github.com/matomo-org/matomo/pull/19918

  • [ ] INFO [2022-10-27 04:10:03] 21867 'PHP Deprecated: Function utf8_encode() is deprecated in /var/www/html/piwik/vendor/szymach/c-pchart/constants.php on line 48

  • [ ] PHP Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/piwik/vendor/symfony/console/Symfony/Component/Console/Helper/DialogHelper.php on line 52
    --> possibly fixed with https://github.com/matomo-org/matomo/pull/18328

  • [ ] PHP Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/piwik/vendor/symfony/console/Symfony/Component/Console/Helper/QuestionHelper.php on line 120
    --> possibly fixed with https://github.com/matomo-org/matomo/pull/18328

  • [ ] PHP Deprecated: Function utf8_encode() is deprecated in /var/www/html/piwik/vendor/szymach/c-pchart/constants.php on line 48

@sgiehl commented on October 31st 2022 Member

@justinvelluppillai The first one is something we can fix. The others are caused by vendor libs, so we can only fix that with updating the libs...

@justinvelluppillai commented on October 31st 2022 Member

Yes I see that 👍🏽

@Findus23 commented on November 14th 2022 Member

For the remaining vendor lib deprecation warning, I created an issue here: https://github.com/szymach/c-pchart/issues/86

Powered by GitHub Issue Mirror