The first alpha of php8.1 was just released:
https://www.php.net/archive/2021.php#2021-06-10-1
There are a few breaking changes, so it might be useful to already start fixing things to get them released in time.
Changes: https://github.com/php/php-src/blob/php-8.1.0alpha1/UPGRADING
The major breaking change is that built-in functions now (just like user-defined functions) no longer accept null in non-nullable arguments:
https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg
Got invalid response from API request: ?module=API&method=CoreAdminHome.archiveReports&idSite=16&period=month&date=2020-09-01&format=json&trigger=archivephp. Response was
DataArray->sumMetricsPivot expects rows of numeric values, non numeric found: '2020-09-14' for column 0 - in plugin Cohorts. #0 \/home\/lukas\/public_html\/matomophp8\/core\/ArchiveProcessor\/Loader.php(218): Piwik\ArchiveProcessor\PluginsArchiver->callAggregateAllPlugins(1, 0, false) #1 \/home\/lukas\/public_html\/matomophp8\/core\/ArchiveProcessor\/Loader.php(158): Piwik\ArchiveProcessor\Loader->prepareAllPluginsArchive(1, 0) #2 \/home\/lukas\/public_html\/matomophp8\/core\/ArchiveProcessor\/Loader.php(101): Piwik\ArchiveProcessor\Loader->prepareArchiveImpl('VisitsSummary') #3 \/home\/lukas\/public_html\/matomophp8\/core\/Context.php(75): Piwik\ArchiveProcessor\Loader->Piwik\ArchiveProcessor\{closure}() #4 \/home\/lukas\/public_html\/matomophp8\/core\/ArchiveProcessor\/Loader.php(105): Piwik\Context::changeIdSite(16, Object(Closure)) #5 \/home\/lukas\/public_html\/matomophp8\/plugins\/CoreAdminHome\/API.php(278): Piwik\ArchiveProcessor\Loader->prepareArchive('VisitsSummary') #6 \/home\/lukas\/public_html\/matomophp8\/core\/Archive.php(830): Piwik\Plugins\CoreAdminHome\API->archiveReports(16, Object(Piwik\Period\Week), '2020-09-14', '', 'VisitsSummary', '') #7 \/home\/lukas\/public_html\/matomophp8\/core\/Archive.php(629): Piwik\Archive->prepareArchive(Array, Object(Piwik\Site), Object(Piwik\Period\Week)) #8 \/home\/lukas\/public_html\/matomophp8\/core\/Archive.php(576): Piwik\Archive->cacheArchiveIdsAfterLaunching(Array, Array) #9 \/home\/lukas\/public_html\/matomophp8\/core\/Archive.php(502): Piwik\Archive->getArchiveIds(Array) #10 \/home\/lukas\/public_html\/matomophp8\/core\/Archive.php(312): Piwik\Archive->get(Array, 'numeric')
[...]
Deprecated - Implicit conversion from float 695.5555555555555 to int loses precision
$1/vendor/davaxi/sparkline/src/Sparkline/Picture.php(115)
$2/vendor/davaxi/sparkline/src/Sparkline.php(124)
$3/vendor/davaxi/sparkline/src/Sparkline.php(188)
$4/core/Visualization/Sparkline.php(215)
$5/plugins/CoreVisualizations/Visualizations/Sparkline.php(107)
$6/core/Plugin/Controller.php(247)
$7/plugins/UserCountry/Controller.php(142)$9/core/FrontController.php(619)
Deprecated - Implicit conversion from float 74.08333333332371 to int loses precision
$1/vendor/szymach/c-pchart/src/Chart/BaseDraw.php(290)
$2/vendor/szymach/c-pchart/src/Chart/Draw.php(1569)
$3/vendor/szymach/c-pchart/src/Chart/Draw.php(1517)
$4/vendor/szymach/c-pchart/src/Chart/Draw.php(987)
$5/vendor/szymach/c-pchart/src/Chart/Draw.php(115)
$6/vendor/szymach/c-pchart/src/Chart/Draw.php(910)
$7/vendor/szymach/c-pchart/src/Chart/Draw.php(6001)
$8/plugins/ImageGraph/StaticGraph/Evolution.php(27)
$9/plugins/ImageGraph/API.php(496)
Deprecated - imagefilledpolygon(): Using the $num_points parameter is deprecated
$1/vendor/szymach/c-pchart/src/Chart/Draw.php(82)
$2/vendor/szymach/c-pchart/src/Chart/Draw.php(910)
$3/vendor/szymach/c-pchart/src/Chart/Draw.php(6001)
$4/plugins/ImageGraph/StaticGraph/Evolution.php(27)
$5/plugins/ImageGraph/API.php(496)$7/core/API/Proxy.php(244)
$8/core/Context.php(28)
$9/core/API/Proxy.php(335)
https://github.com/twigphp/Twig/pull/3552
(no release yet)
Deprecated - Return type of Twig\Markup::count() should either be compatible with Countable::count(): int, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
$0/vendor/twig/twig/src/Markup.php(19)
$1/vendor/composer/ClassLoader.php(476)
$2/vendor/composer/ClassLoader.php(344)
$3/tmp/templates_c/7a/7a036532364d2339c82a6df4f07f7846cf6cbdec663dc41aa70fa9438b6cc75a.php(44)
$4/vendor/twig/twig/src/Template.php(394)
$5/vendor/twig/twig/src/Template.php(367)
$6/vendor/twig/twig/src/Template.php(379)
$7/vendor/twig/twig/src/TemplateWrapper.php(40)
$8/vendor/twig/twig/src/Environment.php(277)
$9/core/View.php(318)
$idSite == 'all'
and use $idSite === 'all'
and similar ones see https://3v4l.org/17cZ2 Deprecated - Return type of Twig\Node\Node::count() should either be compatible with Countable::count(): int, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
$0/vendor/twig/twig/src/Node/Node.php(23)
$1/vendor/composer/ClassLoader.php(476)
$2/vendor/composer/ClassLoader.php(344)
$3/vendor/twig/twig/src/Node/TextNode.php(22)
$4/vendor/composer/ClassLoader.php(476)
$5/vendor/composer/ClassLoader.php(344)
$6/vendor/twig/twig/src/Parser.php(123)
$7/vendor/twig/twig/src/Parser.php(84)
$8/vendor/twig/twig/src/Environment.php(479)
$9/vendor/twig/twig/src/Environment.php(507)
to be updated...
Some more unsorted warnings:
WARNING [2021-08-09 21:54:51] 266648 /home/lukas/public_html/matomophp8/core/AssetManager/UIAssetCacheBuster.php(49): Deprecated - trim(): Passing null to parameter <a href='/1'>#1</a> ($string) of type string is deprecated - Matomo 4.4.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
Comment by @sgiehl: This one is fixed ✔️
matomo.log gets really large really quickly as there are many deprecation warnings that are called many times per request.
So I wrote a quick script to deduplicate all warnings to make it easier to see them:
logging.py ```python import re basepath = "/home/lukas/public_html/matomophp8/" regex = re.compile(r"\[[\d\w]+\] ([/\w\-\.()]+):(.+) - Matomo 4.4.+ ((?:(?:#0)|(?:\[internal function\])).*)") warnings = {} with open("tmp/logs/matomo.log") as f: for line in f: if not line.startswith("WARNING"): continue # print(line) result = regex.findall(line) if not result: print(line) print(result) continue path, warning, trace = result[0] trace = trace.replace("#","$").split(",") warnings[path] = (warning, trace) # overwrites warnings in the same line warnings = dict(sorted(warnings.items(), key=lambda item: item[0])) for path, data in warnings.items(): warning, trace = data path = path.replace(basepath, "").strip() print("- [ ]", path) print(">", warning.strip()) for line in trace: print(">",line) file = path.split("(")[0] lineno = path.split("(")[-1][:-1] if "vendor" not in file: print("> " "https://github.com/matomo-org/matomo/" "blob/99136cbf3183833b5d9dedb7943873fb8c3a8da5/" f"{file}#L{lineno}") print() print(len(warnings), "unique warnings") ```I'll add all new warnings I find in the issue above (now also with stack trace as I think some of them are only fixable when knowing where the data comes from).
Is it better to make a number of smaller PRs to get these fixes merged or combine them all into one? I've made a few fixes in #17929, there are also many plugin PRs coming.
@justinvelluppillai small ones be a lot better.
Is this too small or a good size?
https://github.com/matomo-org/matomo/pull/17989
I could simply add more commits like this to not make too many PRs.
It's hard to say re too small or good size @geekdenz . You want to put things that fix the same kind of issue into the same PR. Like if count()
is a problem then you put all the places where count is a problem in the same PR. If that then applies to say to more than 10 different files then it may be good to split it in multiple PRs probably simply for the review to be easier but it really depends on a case by case basis.
OK. Thanks @tsteur .
I recommend we leave this until at least xdebug
works with PHP 8.1.
root<a class='mention' href='https://github.com/42b8ea256385'>@42b8ea256385</a>:/usr/src/myapp# pecl install xdebug
pecl/xdebug requires PHP (version >= 7.2.0, version <= 8.0.99), installed version is 8.1.0RC1
No valid packages found
install failed
I could not login and it seemed to be in a loop which is hard to debug without a debugger.
I gave it another shot without running the VisitorGenerator plugin and basics seem to work now. :-)
My take on "too small" would be to limit the number of PRs, but make a separate commit per fix.
basics seem to work now
I think the basics (as in clicking around in the Matomo UI) already worked before I made any changes. But I might be misremembering something.
too small
It's using one's best judgement what is too small or too big i guess.
basics seem to work now
Yeah, just had a quick look at the ui which seems to work. The main problem is probably the tracker.
We might also need to look at usages like $idSite == 'all'
and use $idSite === 'all'
and similar ones see https://3v4l.org/17cZ2 will add it to the list
I've fixed all that I can currently reproduce using PHP8.1 rc5.
I tried 4.6.0-beta3 on PHP 8.1-RC5 and found that in plugins/GeoIp2/LocationProvider/GeoIp2/Php.php, function setCountryResults(), a couple of strtoupper() calls are intermittently throwing deprecation errors, when $lookupResult->continent->code
and/or $lookupResult->country->isoCode
are null.
[error] 6237<a href='/6237'>#6237</a>: *14869843 FastCGI sent in stderr: "
PHP message: PHP Deprecated: strtoupper(): Passing null to parameter <a href='/1'>#1</a> ($string) of type string is deprecated in [...]/plugins/GeoIp2/LocationProvider/GeoIp2/Php.php on line 242
PHP message: PHP Deprecated: strtoupper(): Passing null to parameter <a href='/1'>#1</a> ($string) of type string is deprecated in [...]/plugins/GeoIp2/LocationProvider/GeoIp2/Php.php on line 243
" while reading response header from upstream,
There's another strtoupper call in setCityResults(), but it was averted in #17869, as noted above:
$result[self::REGION_CODE_KEY] = $subdivision->isoCode ? strtoupper($subdivision->isoCode) : $this->determineRegionIsoCodeByNameAndCountryCode($subdivision->name, $result[self::COUNTRY_CODE_KEY]);
@GreenReaper Thanks for mentioning that. I'll create a PR to fix them.
When running tests locally there occurs a
PHP Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /srv/matomo/vendor/symfony/console/Symfony/Component/Console/Helper/HelperSet.php on line 104
Which we can't fix without updating symfony console (if it's already fixed there).
--> will be fixed with https://github.com/matomo-org/matomo/pull/18328
After fresh installation (with existing database), system check page works well but then after clicking next following error appears in my apache2 error.log
[Sun Nov 28 19:53:17.225769 2021] [php:error] [pid 1729006] [client x.x.x.x:54686] PHP Fatal error: Uncaught DI\Definition\Exception\InvalidDefinition: Entry "Monolog\Logger" cannot be resolved: the class doesn't exist\nFull definition:\nObject (\n class = Monolog\Logger\n lazy = false\n __construct(\n $name = 'piwik'\n $handlers = get(log.handlers)\n $processors = get(log.processors)\n )\n) in /var/www/html/matomo/vendor/php-di/php-di/src/Definition/Exception/InvalidDefinition.php:19\nStack trace:\n#0 /var/www/html/matomo/vendor/php-di/php-di/src/Definition/Resolver/ObjectCreator.php(121): DI\Definition\Exception\InvalidDefinition::create()\n#1 /var/www/html/matomo/vendor/php-di/php-di/src/Definition/Resolver/ObjectCreator.php(71): DI\Definition\Resolver\ObjectCreator->createInstance()\n#2 /var/www/html/matomo/vendor/php-di/php-di/src/Definition/Resolver/ResolverDispatcher.php(71): DI\Definition\Resolver\ObjectCreator->resolve()\n#3 /var/www/html/matomo/vendor/php-di/php-di/src/Container.php(390): DI\Definition\Resolver\ResolverDispatcher->resolve()\n#4 /var/www/html/matomo/vendor/php-di/php-di/src/Container.php(139): DI\Container->resolveDefinition()\n#5 /var/www/html/matomo/vendor/php-di/php-di/src/Definition/Reference.php(53): DI\Container->get()\n#6 /var/www/html/matomo/vendor/php-di/php-di/src/Definition/Resolver/ResolverDispatcher.php(66): DI\Definition\Reference->resolve()\n#7 /var/www/html/matomo/vendor/php-di/php-di/src/Container.php(390): DI\Definition\Resolver\ResolverDispatcher->resolve()\n#8 /var/www/html/matomo/vendor/php-di/php-di/src/Container.php(139): DI\Container->resolveDefinition()\n#9 /var/www/html/matomo/core/Container/StaticContainer.php(81): DI\Container->get()\n#10 /var/www/html/matomo/core/FrontController.php(269): Piwik\Container\StaticContainer::get()\n#11 [internal function]: Piwik\FrontController::triggerSafeModeWhenError()\n#12 {main}\n thrown in /var/www/html/matomo/vendor/php-di/php-di/src/Definition/Exception/InvalidDefinition.php on line 19, referer: https://mywebsite.com/matomo/index.php?module=Login&action=databaseSetup&clientProtocol=https
Installed packages:
ii libapache2-mod-php8.1 8.1.0-1+0~20211125.10+debian10~1.gbp177308 amd64 server-side, HTML-embedded scripting language (Apache 2 module)
ii php-common 2:85+0~20211110.38+debian10~1.gbp73ad3b all Common files for PHP packages
ii php8.1-cli 8.1.0-1+0~20211125.10+debian10~1.gbp177308 amd64 command-line interpreter for the PHP scripting language
ii php8.1-common 8.1.0-1+0~20211125.10+debian10~1.gbp177308 amd64 documentation, examples and common module for PHP
ii php8.1-curl 8.1.0-1+0~20211125.10+debian10~1.gbp177308 amd64 CURL module for PHP
ii php8.1-gd 8.1.0-1+0~20211125.10+debian10~1.gbp177308 amd64 GD module for PHP
ii php8.1-mbstring 8.1.0-1+0~20211125.10+debian10~1.gbp177308 amd64 MBSTRING module for PHP
ii php8.1-mysql 8.1.0-1+0~20211125.10+debian10~1.gbp177308 amd64 MySQL module for PHP
ii php8.1-opcache 8.1.0-1+0~20211125.10+debian10~1.gbp177308 amd64 Zend OpCache module for PHP
ii php8.1-readline 8.1.0-1+0~20211125.10+debian10~1.gbp177308 amd64 readline module for PHP
ii php8.1-sqlite3 8.1.0-1+0~20211125.10+debian10~1.gbp177308 amd64 SQLite3 module for PHP
ii php8.1-xml 8.1.0-1+0~20211125.10+debian10~1.gbp177308 amd64 DOM, SimpleXML, XML, and XSL module for PHP
@WebWire-NL Just to be sure: This happens in the installation process after the system check, right? Could you check if a config file was already created and if so which plugins are listed as active within in?
@sgiehl Hi, i'm sorry but i reverted to php7.4 :( i can't check anymore.... but i guess nothing was done as the server responded with a 500 error. The error appears after the system check page... so system check only gives a warning about git because i tried the latest version.... and then if you try to go to the next step a 500 error will occur and this was what i could find in the server logs.
@WebWire-NL Which version did you try to install on PHP 8.1? A latest git checkout or a specific release?
I tried branch 4.6.2 and another Branch (might be even the master branch?)
which both had last change date of 2 days ago....
Op ma 29 nov. 2021 11:50 schreef Stefan Giehl @.***>:
@WebWire-NL https://github.com/WebWire-NL Which version did you try to
install on PHP 8.1? A latest git checkout or a specific release?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/matomo-org/matomo/issues/17686#issuecomment-981517941,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AD5FZL7MKBNWWBDPCKNOGVTUONLHFANCNFSM464PY6OQ
.
Triage notifications on the go with GitHub Mobile for iOS
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
or Android
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Got WARNING on stripos() (4.6.1)
WARNING Actions[2021-12-04 03:29:57 UTC] [9d278] /var/www/matomo/plugins/Actions/VisitorDetails.php(156): Deprecated - stripos(): Passing null to parameter <a href='/1'>#1</a> ($haystack) of type string is deprecated - Matomo 4.6.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) [internal function]: Piwik\ErrorHandler::errorHandler(),<a href='/1'>#1</a>/plugins/Actions/VisitorDetails.php(156),<a href='/2'>#2</a>/plugins/Live/Visitor.php(289),<a href='/3'>#3</a>/plugins/Live/API.php(348),[internal function]: Piwik\Plugins\Live\API->Piwik\Plugins\Live\{closure}(),<a href='/5'>#5</a>/core/DataTable.php(512),<a href='/6'>#6</a>/core/DataTable.php(618),<a href='/7'>#7</a>/core/API/DataTablePostProcessor.php(304),<a href='/8'>#8</a>/core/API/DataTablePostProcessor.php(134),<a href='/9'>#9</a>/core/API/ResponseBuilder.php(190)
From https://forum.matomo.org/t/container-php-68-deprecated-container-php-73-deprecated/43930
with PHP 8.1:
WARNING: \libs\HTML\QuickForm2\Container.php(68): Deprecated - Return type of HTML_QuickForm2_ContainerIterator::hasChildren() should either be compatible with RecursiveArrayIterator::hasChildren(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice - Matomo 4.6.1 - 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: MultiSites, Action: index, In CLI mode: false)
WARNING: \libs\HTML\QuickForm2\Container.php(73): Deprecated - Return type of HTML_QuickForm2_ContainerIterator::getChildren() should either be compatible with RecursiveArrayIterator::getChildren(): ?RecursiveArrayIterator, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice - Matomo 4.6.1 - 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: MultiSites, Action: index, In CLI mode: false)
WARNING: \core\CliMulti\Process.php(290): Deprecated - trim(): Passing null to parameter #1 ($string) of type string is deprecated - Matomo 4.6.1 - 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: Installation, Action: getSystemCheck, In CLI mode: false)
WARNING: \core\CliMulti\Process.php(308): Deprecated - trim(): Passing null to parameter #1 ($string) of type string is deprecated - Matomo 4.6.1 - 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: Installation, Action: getSystemCheck, In CLI mode: false)
WARNING: \core\CliMulti\Process.php(258): Deprecated - trim(): Passing null to parameter #1 ($string) of type string is deprecated - Matomo 4.6.1 - 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: Installation, Action: getSystemCheck, In CLI mode: false)
@sgiehl does one of your last updates fix https://github.com/matomo-org/matomo/issues/17686#issuecomment-985959488 ?
(as a new post in the forum also mentions this bug...)
@heurteph-ei That should have been fixed here: https://github.com/matomo-org/matomo/pull/18330/files#diff-71a1671fa6d1cb22b6c82a3eeb8f845616ad6e8b916070267ba75025d5f08d48R156
I guess meanwhile most issues should be sorted out. At least those that were reported here or I was able to find when running the tests on PHP 8.1. There might still be some issues in third party libs we are using, but most of them published updates as well.
In PHP8.1 on Debian I'm seeing the same dependency injection explosion mentioned in https://github.com/matomo-org/matomo/issues/17686#issuecomment-981142124
Is this known? Should I file a separate issue? What additional details do you need?
(double-escaping due to logging setup, sorry)
PHP Fatal error: Uncaught DI\Definition\Exception\InvalidDefinition: Entry "Monolog\Logger" cannot be resolved: the class doesn't exist
AH01071: Got error 'PHP message: PHP Fatal error:
Uncaught DI\\Definition\\Exception\\InvalidDefinition: Entry "Monolog\\Logger" cannot be resolved: the class doesn't exist
Full definition:
Object (
class = Monolog\\Logger
lazy = false
__construct(
$name = 'piwik'
$handlers = get(log.handlers)
$processors = get(log.processors)
)
) in <path>/vendor/php-di/php-di/src/Definition/Exception/InvalidDefinition.php:19
Stack trace:
<a href='/0'>#0</a> <webroot>/vendor/php-di/php-di/src/Definition/Resolver/ObjectCreator.php(121): DI\\Definition\\Exception\\InvalidDefinition::create()
<a href='/1'>#1</a> <webroot>/vendor/php-di/php-di/src/Definition/Resolver/ObjectCreator.php(71): DI\\Definition\\Resolver\\ObjectCreator->createInstance()
<a href='/2'>#2</a> <webroot>/vendor/php-di/php-di/src/Definition/Resolver/ResolverDispatcher.php(71): DI\\Definition\\Resolver\\ObjectCreator->resolve()
<a href='/3'>#3</a> <webroot>/vendor/php-di/...
@thcipriani Where exactly did that error occur? After updating an existing instance or when trying to install a new one?
@thcipriani Where exactly did that error occur? After updating an existing instance or when trying to install a new one?
Happened when "updating" an existing install. Debian sid swapped out the php
package, so unattended-upgrades helpfully moved my personal site overnight. I grabbed this out the error log.
I'll close this one now. Wasn't able to find any other issues while clicking randomly through the UI or while running tests on PHP 8.1. There for sure might be some issues somewhere that didn't pop up yet, or that are introduced with new code later. But guess it would be good to handle those in new issues, so we are better able to track them down.
This issue has been mentioned on Matomo forums. There might be relevant details there:
https://forum.matomo.org/t/matomo-4-8-0-upgrade-warning-for-htmlspecialchars-using-php8-1/45056/3
@sgiehl it seems some htmlspecialchars
deprecated function is still in use... (see previous message)