Repository navigation
Support PHP8.1 #29287
Description
Activity
- added1. to developAccepted and waiting to be taken care ofAccepted and waiting to be taken care of
on Oct 18, 2021 cc @come-nc since you asked :)
I checked the 3rdparty repo and no dep is actively blocking php8.1 right now (overrode the version number to test this)
Reacted by John Molakvoæ and Kowalski DragonReacted by John MolakvoæHello.
I know at least that the use of LDAP resources will be a problem since there are calls to is_resource on ldap_* results in nextcloud code, and those are turned into objects instead in PHP 8.1.
I’d be happy to start a PR to work on that if you want, and at least make sure the unittest suite for user_ldap works on 8.1. I can try to work on the rest of the test suite but I know less about it.
It seems PHPCompatibility is not uptodate for 8.1 yet but at least they provide a nice list of things to look for: PHPCompatibility/PHPCompatibility#1299
Reacted by Carl Schwan, Markus Ritzmann, Mehdi Hamidi and Gaspard d'HautefeuilleReacted by Christoph WurstThere is this error for PHP 8.0 already:
FILE: /home/mcmic/dev/nextcloud/server/lib/private/L10N/Factory.php ----------------------------------------------------------------------------------------------------------------------------------- FOUND 2 ERRORS AFFECTING 2 LINES ----------------------------------------------------------------------------------------------------------------------------------- 595 | ERROR | Function create_function() is deprecated since PHP 7.2 and removed since PHP 8.0; Use an anonymous function instead 600 | ERROR | Function create_function() is deprecated since PHP 7.2 and removed since PHP 8.0; Use an anonymous function instead -----------------------------------------------------------------------------------------------------------------------------------Not sure if this is known already, so noting it here before I forget.
Reacted by Julius Knorr, Christoph Wurst and Markus Ritzmannthanks for the ping @ChristophWurst given the amount of time and people I'd not rush this for 23.0.0 also given the fact that apps might just break because they have php8.1 issues and that covers ours as well as community apps. So this seems to be to short notice for app devs and likely is also to risky for us and the v23 timeline given that we already reach beta status.
Reacted by Christoph WurstNeeded for 8.1 support:
- Bump symfony to 4.4.31 (only found 4.4.30 in composer, seems to be enough for now)
- Fix pimple (or wait for a fix)
- Bump doctrine/dbal to 3.1.2 or newer
- Adapt code to support guzzlehttp/psr7 2.x (pulled by the changes above: https://github.com/guzzle/psr7#upgrading-from-function-api)
- Bump guzzle to 7.4.0
Reacted by Christoph WurstDoes anyone know the reason for d690f90 ?
Does anyone know the reason for d690f90 ?
I suggest we revert ans see what happens :)
Reacted by Côme ChillietThere is a PHP error triggered by the call at https://github.com/nextcloud/server/blob/master/lib/private/Files/Cache/Propagator.php#L89 , because the second parameter is not given and it defaults to
NULLat https://github.com/nextcloud/server/blob/master/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php#L421
And it ends up in a call toPDO::quoteon doctrine side, which triggers a warning as the type is supposed to be anint.
The default value for$typeinPDO::quoteisPDO::PARAM_STRso I will switch to that if there are no objections.
(writing all this here before forgetting why I made the change ^^)
Actually we haveIQueryBuilder::PARAM_STRwhich is an alias and I will use that to match the comment of the functionReacted by Christoph Wurstlibxml_disable_entity_loaderis deprecated but I do not understand what it does and why we call it. Leaving it in for now.@LukasReschke will give you a lesson about it
Reacted by Christoph Wurst and Gaspard d'HautefeuilleReacted by Christoph WurstThe tests for Archive run into this problem: https://stackoverflow.com/questions/64698935/using-ziparchive-with-php-8-and-temporary-files
I tried fixing it by this change:diff --git a/tests/lib/Archive/ZIPTest.php b/tests/lib/Archive/ZIPTest.php index 17a639c9f5..b6eb947f53 100644 --- a/tests/lib/Archive/ZIPTest.php +++ b/tests/lib/Archive/ZIPTest.php @@ -17,6 +17,8 @@ class ZIPTest extends TestBase { } protected function getNew() { - return new ZIP(\OC::$server->getTempManager()->getTemporaryFile('.zip')); + $tmpfile = \OC::$server->getTempManager()->getTemporaryFile('.zip'); + \unlink($tmpfile); + return new ZIP($tmpfile); } }But I get a misterious warning at the end of the tests:
PHP Warning: PHPUnit\TextUI\Command::main(): Cannot destroy the zip context: Can't remove file: No such file or directory in /home/mcmic/.config/composer/vendor/phpunit/phpunit/src/TextUI/Command.php on line 96No idea if the actual code is concerned.
In several cases there are PHP warnings in the tests because the Mock returns null instead of string or int.
When the return type is only present in the phpdoc and is not there as a return type this happens I think.Reacted by Christoph Wurst117 remaining items
@AndyScherzinger thanks for the instructions. I have eventually managed to upgrade manually (downloaded the latest zip to the Apache dir and ran
occ upgrade). Then after upgrading to NC 24 I upgraded PHP to 8.1 and everything went fine. I was afraid that some of the missing system dependencies would break theocc upgradeprocess, but luckily the only PHP module that was broken (because it relied on thelibcuuc*libraries that were upgraded) wasintl, which apparently is not mandatory for the upgrade to run.Reacted by Andy ScherzingerMy pleasure @blacklight and happy to hear you arrived on 24 safely 👍
Several errors:
strtolower(): Passing null to parameter #1 ($string) of type string is deprecated at /nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php#1443rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php#144:
-$encryption = strtolower($encryption); +$encryption = strtolower($encryption ?? '');str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated at /nextcloud/apps/mail/vendor/bytestream/horde-mime/lib/Horde/Mime/Headers/Element.php#145apps/mail/vendor/bytestream/horde-mime/lib/Horde/Mime/Headers/Element.php#145:
-return str_replace("\0", '', $data); +return str_replace("\0", '', $data ?? '');@VVD please raise this at https://github.com/nextcloud/mail/issues including the version infos server/mail-app
- also cc @ChristophWurst since it is related to mail
Can't find files
EsmtpTransport.phpandElement.phpin sources of the https://github.com/nextcloud/mail/.
Both are something else.3rdparty/swiftmailer
https://github.com/nextcloud/3rdparty / https://packagist.org/packages/swiftmailer/swiftmailer
bytestream/horde-mime
https://github.com/bytestream/Mime, addressed in bytestream/Mime#3 and pulled via nextcloud/mail#6647. Unreleased.
Thanks for information.
3rdparty/swiftmailer
https://github.com/nextcloud/3rdparty / https://packagist.org/packages/swiftmailer/swiftmailer
This package is abandoned and no longer maintained. The author suggests using the [symfony/mailer](https://packagist.org/packages/symfony/mailer) package instead.Found commit with PHP8.1 support: swiftmailer/swiftmailer@ee8a1d9
It have "my" patch too.bytestream/horde-mime
https://github.com/bytestream/Mime, addressed in bytestream/Mime#3
Already fixed, but when we can see it in our installation? What are the plans?
During upgrade from 24.0.2 to 24.0.3 I got error:
<b>Deprecated</b>: Return type of RecursiveDirectoryIteratorWithoutData::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in <b>/opt/nextcloud/updater/index.php</b> on line <b>40</b><br /> {"proceed":true}Patch:
--- updater/index.php.orig +++ updater/index.php @@ -37,7 +37,7 @@ } class RecursiveDirectoryIteratorWithoutData extends \RecursiveFilterIterator { - public function accept() { + public function accept(): bool { /** @var \DirectoryIterator $this */ $excludes = [ '.rnd',- Reacted by Andy Scherzinger
- added a commit that references this issue
on Jul 20, 2022 Several errors:
strtolower(): Passing null to parameter #1 ($string) of type string is deprecated at /nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php#1443rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php#144:
-$encryption = strtolower($encryption); +$encryption = strtolower($encryption ?? '');@ChristophWurst (cc @AndyScherzinger )
The above issue with swiftmailer found by @VVD is still open in Nextcloud 25.0.1 and pops up regularely in the NC error log when sending an email.What about the existing fixes swiftmailer/swiftmailer@ee8a1d9 that were not yet integrated into https://github.com/nextcloud/3rdparty/tree/master/swiftmailer/swiftmailer ?
Could you open that as a separate ticket please @creopard? Then one of the server engineers can have a look.
- added a commit that references this issue
on Jul 22, 2026
According to https://php.watch/news/2021/03/php81-release-date PHP8.1 will be released by end of next month. That will mean the release happens somewhere around the release of Nextcloud 23 and we can assume that the early adopters will soon update their systems and find out Nextcloud 23 doesn't support 8.1. Ref
server/lib/versioncheck.php
Lines 36 to 42 in 8226231
As far as I know php8.1 is "just" a minor release but some libs/code have to be adjusted. We'll have to decide whether to look into this for 23, 23.1 or 24.
Potential breaking changes
cc @AndyScherzinger @juliushaertl @nickvergessen @skjnldsv