Date: Monday, April 25, 2022 @ 16:05:33 Author: dvzrv Revision: 1190023
upgpkg: nextcloud 23.0.4-1: Upgrade to 23.0.4. Remove unneeded quotes and curly braces. Remove patches for php 8.1 compatibility and instead rely on upstream's supported range of php versions (currently php7 providing php=7.4 matches). Add helper function to detect nextcloud's php interpreter requirements and system php interpreter version. Add prepare() to override the used interpreter versions in custom occ script, uwsgi integration and nextcloud-cron.service. Switch alpm hook to use the custom occ script (which allows overrides) instead of duplicating the command. Add check() to fail when encountering incompatible php interpreters in the build environment. Change package() to set optdepends dynamically, based on interpreter version. Modified: nextcloud/trunk/PKGBUILD nextcloud/trunk/nextcloud-cron.service nextcloud/trunk/nextcloud.hook nextcloud/trunk/nextcloud.occ.sh nextcloud/trunk/nextcloud.uwsgi Deleted: nextcloud/trunk/nextcloud-23.0.0-php8.1.patch nextcloud/trunk/nextcloud-23.0.0-pimple_php8.1.patch --------------------------------------+ PKGBUILD | 196 ++- nextcloud-23.0.0-php8.1.patch | 1664 --------------------------------- nextcloud-23.0.0-pimple_php8.1.patch | 130 -- nextcloud-cron.service | 5 nextcloud.hook | 2 nextcloud.occ.sh | 2 nextcloud.uwsgi | 4 7 files changed, 122 insertions(+), 1881 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2022-04-25 15:28:43 UTC (rev 1190022) +++ PKGBUILD 2022-04-25 16:05:33 UTC (rev 1190023) @@ -4,13 +4,13 @@ pkgname=nextcloud # NOTE: always check first whether the version is supposed to be packaged: # https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule -pkgver=23.0.3 +pkgver=23.0.4 pkgrel=1 pkgdesc="A cloud server to store your files centrally on a hardware controlled by you" arch=(any) url="https://nextcloud.com" license=(AGPL3) -depends=('php>=8.0.0' 'php<8.2.0' php-gd) +depends=('php>=7.4' 'php<8.1.0' 'php-gd>=7.4' 'php-gd<8.1.0') optdepends=( 'curl: for webcron jobs from within uwsgi' 'ffmpeg: for preview generation' @@ -17,127 +17,165 @@ 'libreoffice: for preview generation' 'mariadb: to use a local MariaDB server' 'memcached: to use a local memcached server' - 'php-apcu: for caching with APCU' - 'php-apache: to use the Apache web server' 'mod_itk: to use the Apache web server' - 'php-fpm: to run in fastCGI process manager' - 'php-imagick: for preview generation' - 'php-imap: for external user authentication' - 'php-intl: to increase language translation performance and fix sorting' - 'php-memcached: for caching with memcached' - 'php-pgsql: to use the PostgreSQL database backend' - 'php-redis: for caching with redis' - 'php-sqlite: to use the SQLite database backend' 'postgresql: to use a local PostgreSQL server' 'redis: to use a local Redis server' 'smbclient: for SMB/CIFS integration' 'sudo: for privilege elevation in occ command when not run as root' - 'uwsgi-plugin-php: run as application container' ) backup=( - "etc/webapps/${pkgname}/config/config.php" - "etc/webapps/${pkgname}/.htaccess" - "etc/uwsgi/${pkgname}.ini" + etc/webapps/$pkgname/config/config.php + etc/webapps/$pkgname/.htaccess + etc/uwsgi/$pkgname.ini ) # there are no elf files, no need to strip anything options=(!strip) -install="${pkgname}.install" +install=$pkgname.install source=( - "https://download.nextcloud.com/server/releases/nextcloud-${pkgver}.tar.bz2"{,.asc} - 'apache.example.conf' - "${pkgname}.config.php" - "${pkgname}.hook" - "${pkgname}.occ.sh" - "${pkgname}.sysusers" - "${pkgname}.tmpfiles" - "${pkgname}.uwsgi" - "${pkgname}-cron.service" - "${pkgname}-cron.timer" - "${pkgname}-23.0.0-php8.1.patch" - "${pkgname}-23.0.0-pimple_php8.1.patch" + https://download.nextcloud.com/server/releases/$pkgname-$pkgver.tar.bz2{,.asc} + apache.example.conf + $pkgname.config.php + $pkgname.hook + $pkgname.occ.sh + $pkgname.sysusers + $pkgname.tmpfiles + $pkgname.uwsgi + $pkgname-cron.service + $pkgname-cron.timer ) -sha512sums=('406e9c0615447ffa9f77104e067d1d6b73262d78388e531ebcd8de3a759260a26bf08461997a8513ce910b8de81775d6ccad65a26f38e159014aebf6a555aa23' +sha512sums=('f43acf7c9df6e3105d9085bf9b4c95eebca83812980b933cd57920dec5684c34fe47e8f5395aa7eed806c75f13049790a30b2f8abce8738f9e8a55b24280871f' 'SKIP' '5f9be223225e6ad2772989c440df8585a852ea0be697274384064ec73df47dab2f5d0847c275732fab26c419a713911d8f77ebc2b639bf6e8ede76272b752cde' '92592f9a76ee534d0ae6d3aedf2257c147337debe7e2d6dbec1daff66a682e3abc74611e08662058de314bf3ea6ff1c85efd678674b782d71251c38786e446f9' - '7b18b73ee369607b8ee3d00d2a054262a7b8f3033fc4873eb333c9b9333d7338870c035910ae123b564a65d7d245730178137311048f0713d5bc524de3654923' - 'daae0331998fc3b135c18330cd8f8405958abce1a913cdbc16accc3c49f2b185a6d44cf4d768eb1eb11d1dd1d81dcc3fe75ec959bd9f4c9c5eb85c450d5ad408' + '2791382d7b005c64cd6938695f273e83435cc5f1b785fe7d44d6dbd69864c502847e45d93c4a5f6752a759a660118279e3e22e5bc32f79b8775693fde603a9c5' + '20f12f0bb1d0ac735fb86e79e90fb99028e06e0d5a6842d449e443b418442682cad2573cfd4bf8e2a802c2aeb5780bce4647d45054bbc38156ae037802358698' '1d06f339c43d57e5f5406c2698b815241fd9e39039a9e55f777face510c9a5ddae5ccd4e051393e8f16f391301a6aa03fff2462837a2d3441d969ea7195e7d84' '919008a2bf6cf2492cb1e9c8e28c1e082d74e45da5a96e6669f8971d6cf721e36d23625c89918fe10d8bc1b202c0340aa897849d9ec501a26f3f4572ccb57a98' - '8bc7e76ba986cadf8d3bf35d6fbd8e7e236a61d1372e023c07e60427bacce925737c996d9fbaaeb51ed1066c1d0c8d83a86d7d640ed991b531744ed06629a670' - 'c585af280c2503a5a969fffd53d192a045a1dedd6d3a32901dfa0e226f9ddb4b5d1b1760553e962b061172c0077fcc57b095d8b7c70cafaa8ca84dbfce2eaa24' - 'eb69785a5b0df0e2a11f53f9c2e2dbf75681d7c698e88cbcc5ceed713a558d528511cc576813cc083cbaa28a2c83d543a39436ad4805670348ef22634305b1c8' - '13062af253ceaafa4a65cdbd808318c643acc654f60454b31674e4f03bf49d1b20c5d0b3907f1d520871819eccb141968470defb7e48c1c7fba450af12361b9b' - 'd5552d111f6632878173976987464723de222c45aeb529ad922590613a21586d54b8b5d55c056934a2c8998c08ea2e66c4c4d2fdda265f5372b5e87719770ceb') -b2sums=('271d247d66c80e2b342e435ec5b1a627703e09adc373e52a3bfe0a0802b698759c25904e6c489033ba3f6028155b5c0c5bcbcb2378089eddefe2dd967ecabe4b' + '67d32011e3dccf41ecaaeffa7486e70b8ee516b3423796c19cc9c95ba6ecd5d031540eeacefb9423fdfc70b1baad15a4885b7147cfbbb2773b349e72d3fe4df2' + '5034d4f78090a7455521fc2e7e391c8eab06b503979c5f14d4144e52c08717e7fc796e0e3048059b1e5802365667c6f87162b5c403cac971e1b77fc1688596f3' + 'eb69785a5b0df0e2a11f53f9c2e2dbf75681d7c698e88cbcc5ceed713a558d528511cc576813cc083cbaa28a2c83d543a39436ad4805670348ef22634305b1c8') +b2sums=('6202ca26c1fd2839cd46651dfb727e20ea8eaab5329aedb905d23817ed3399ce999aff3161f0a6301d558a7acf537b8b54befeabe831e132a56b22bc3c13e635' 'SKIP' '7d40d120c28291f1a7537f3e1b5049fa83c9c0af949371345ea9ccdf3de4a0f3a3a06edbc52d9254dba483e4d11acf562cf679b9e379c5dfc2f61dfbfc2e4cef' '4ad061efbc20b4d0e9f8cfd01c5e8e612fa5af29bce754b77f90c1835b98ee445ef4de3d8c83da91461053622620af14d880eb9014b51f2383c75f1860d479f4' - '772a9571fe7d88dbcbeb46351a188354e237dfe8e020131f2752b3a36cff0ff177423b4cfd6a1a5f28946f86a8581f3e24ee06ebda7260c5f862ca4071908e43' - '150273823fdadcaecf3e2af036067581cb4cf02507c6da2a533ef3c288a2a715d076f83c6d6d4ff13cd336184f595361318faa2acdc68979edfad7afef0b575b' + 'c69f18de513562e32f0f655fee7ef81877d74a76717e2eaad9a13882bf8edd0dad99bec5958e460a4ec32eecfdd425ae009d11ac27af16a3ad1d6498282be32f' + 'f3d1423a457c7a24c25c8b18e24b838b63e99a7f7562ded954ea605c76bbd31e8e79158314e1343e341aa21b6a26dc57ca4f00b871bbc170f6b7d5044985e661' '1a61a89531636b65dade03cd7edca8747b3e1e880f9bbd4d5a53cffa452d70fe17e345cfed739ae92e99e336d4c1f2633c84a5c84a4ee6da518762bf1396b1db' 'd132044cb7f1d61a1ce87800d2e1142e3ac385acdec25e2f5ad685603a0ffa88e105f4c35688584d65d287adbb40b8d9a02d6a80d7a0b58bb8801a6769405218' - '937ae5b89d968d784c7b68e1ca81e7aec11e295b95244fc4bcfec55b3d5f37ef70d5f593086eeb14101c8940a241565730cb6edcdf88165094c4ad27a89bd980' - '9857f3dd219b624869255e0d6c262b60de813b87ac4fd3fccad0a330392f55709e8c2d4b9dfb5ad19df7cc0fc13cc83cead06c9a1d893ee4e4972c4937df0c2b' - 'e6214351ca16bfe97683e838e727d6b5eaa62194878272204034c62aac4a632c9b33cd31aa0570c2eb936d7e9e7ff60190ac05a3a8cc2e27eda423a7d89b6d39' - 'd29c475db8a8fd083bf3981914a298d105484ee71e3dcbc9c726ea675b6f2dc56cf135850c22ac5231becdf1bcc6994ff645b179f7d14e0ace692e460ba2052b' - '3050c5c5f5befd044c892f67f1a194d42cb6ed9cd0b54d0a69258b26605da7f21bc781780e963846c26ece5fcf9f3987e832b4b1bbd8db91feea97fe4502c6d1') + '67fa7d9207ab3e8309d4adcce734bd25f82bd03f1f88adea7e40adaddebb345b96a793df7960db79f4f39947f5edff61548bb409066b81e3fe643d313e68d66a' + 'fefaf3238475e991c2dc2bda7cda17019d473e8bbafa9817a31a941552c7362e2e12aad1aa925c45a595ab9f0b645b8d4b4236c86ecf8db87e662a7a05ddfcd5' + 'e6214351ca16bfe97683e838e727d6b5eaa62194878272204034c62aac4a632c9b33cd31aa0570c2eb936d7e9e7ff60190ac05a3a8cc2e27eda423a7d89b6d39') validpgpkeys=('28806A878AE423A28372792ED75899B9A724937A') # Nextcloud Security <secur...@nextcloud.com> +_get_php_versions() { + local _phps=(php7 php) + local _min _max + + _min=$(sed -nr 's/^.*PHP_VERSION_ID < ([0-9]*).*$/\1/p' $pkgname/lib/versioncheck.php) + _max=$(sed -nr 's/^.*PHP_VERSION_ID >= ([0-9]*).*$/\1/p' $pkgname/lib/versioncheck.php) + _min_php="${_min:0:1}.${_min:2:1}" + _max_php="${_max:0:1}.${_max:2:1}" + + _php_interpreter="" + for _php in "${_phps[@]}"; do + if command -v "$_php" > /dev/null; then + if [[ -z "$_php_interpreter" ]]; then + _php_interpreter="$_php" + fi + fi + done + _system_php="$($_php_interpreter --version |head -n1 |cut -d ' ' -f2)" + printf "Detected php interpreter %s\n" $_php_interpreter + printf "Detected php %s\n" $_system_php + printf "%s requires %s >= php < %s\n" $pkgname $_min_php $_max_php +} + prepare() { - cd "${pkgname}" - # add backported patch for php 8.1 support: - # https://github.com/nextcloud/server/pull/29432 - # https://github.com/nextcloud/server/pull/29862 - patch -Np1 -i ../"${pkgname}-23.0.0-php8.1.patch" - # add backported patch for php 8.1 support in pimple 3rdparty submodule: - # https://github.com/nextcloud/3rdparty/pull/905 - ( - cd 3rdparty - patch -Np1 -i ../../"${pkgname}-23.0.0-pimple_php8.1.patch" - ) + local _file + + _get_php_versions + + # setup files with default PHP interpreter + mkdir -vp custom_files + for _file in nextcloud.{occ.sh,uwsgi} nextcloud-cron.service; do + sed "s/PHP_INTERPRETER/$_php_interpreter/g" $_file > custom_files/$_file + done } +check() { + _get_php_versions + if [[ "$(vercmp "$_system_php" "$_min_php" )" -lt 0 ]]; then + printf "%s requires php >= %s, but %s is provided\n" $pkgname $_min_php $_system_php + exit 1 + fi + if [[ "$(vercmp "$_system_php" "$_max_php" )" -gt 0 ]]; then + printf "%s requires php < %s, but %s is provided\n" $pkgname $_max_php $_system_php + exit 1 + fi +} + package() { - cd "${pkgname}" + local _dep_ver="" + _get_php_versions + + if [[ "$_php_interpreter" != *php ]]; then + _dep_ver="${_system_php%%.*}" + fi + + # NOTE: due to weird makepkg checks we can't add optdepends with dynamically derived contents directly + _optdepends=( + "php$_dep_ver-apcu: for caching with APCU" + "php$_dep_ver-apache: to use the Apache web server" + "php$_dep_ver-fpm: to run in fastCGI process manager" + "php$_dep_ver-imagick: for preview generation" + "php$_dep_ver-imap: for external user authentication" + "php$_dep_ver-intl: to increase language translation performance and fix sorting" + "php$_dep_ver-memcached: for caching with memcached" + "php$_dep_ver-pgsql: to use the PostgreSQL database backend" + "php$_dep_ver-redis: for caching with redis" + "php$_dep_ver-sqlite: to use the SQLite database backend" + "uwsgi-plugin-php$_dep_ver: run as application container" + ) + optdepends+=("${_optdepends[@]}") + + cd $pkgname # sysusers.d integration - install -vDm 644 ../${pkgname}.sysusers \ - "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf" + install -vDm 644 ../$pkgname.sysusers "$pkgdir/usr/lib/sysusers.d/$pkgname.conf" # tmpfiles.d integration - install -vDm 644 ../${pkgname}.tmpfiles \ - "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf" + install -vDm 644 ../$pkgname.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf" # state dir for data and writable apps - install -vdm 755 "${pkgdir}/var/lib/${pkgname}/" - install -vdm 770 "${pkgdir}/var/lib/${pkgname}/data" - install -vdm 755 "${pkgdir}/var/lib/${pkgname}/apps" + install -vdm 755 "$pkgdir/var/lib/$pkgname/" + install -vdm 770 "$pkgdir/var/lib/$pkgname/data" + install -vdm 755 "$pkgdir/var/lib/$pkgname/apps" # log dir - install -vdm 755 "${pkgdir}/var/log/${pkgname}/" + install -vdm 755 "$pkgdir/var/log/$pkgname/" # uwsgi integration - install -vDm 644 "../${pkgname}.uwsgi" "${pkgdir}/etc/uwsgi/${pkgname}.ini" + install -vDm 644 ../custom_files/$pkgname.uwsgi "$pkgdir/etc/uwsgi/$pkgname.ini" # config dir - install -vDm 644 .htaccess -t "${pkgdir}/etc/webapps/${pkgname}/" - install -vDm 640 "../${pkgname}.config.php" "${pkgdir}/etc/webapps/${pkgname}/config/config.php" - find config -type f -exec install -vDm 644 {} "${pkgdir}/etc/webapps/${pkgname}/"{} \; + install -vDm 644 .htaccess -t "$pkgdir/etc/webapps/$pkgname/" + install -vDm 640 ../$pkgname.config.php "$pkgdir/etc/webapps/$pkgname/config/config.php" + find config -type f -exec install -vDm 644 {} "$pkgdir/etc/webapps/$pkgname/"{} \; # remove config dir and .htaccess from source so that it is not installed to default location rm -rf config .htaccess # webapp - find . -type f -not -iname "*.orig" -exec install -vDm 644 {} "${pkgdir}/usr/share/webapps/${pkgname}/"{} \; + find . -type f -not -iname "*.orig" -exec install -vDm 644 {} "$pkgdir/usr/share/webapps/$pkgname/"{} \; # symlink config directory into place - ln -sv "/etc/webapps/${pkgname}/config" "${pkgdir}/usr/share/webapps/${pkgname}/" + ln -sv /etc/webapps/$pkgname/config "$pkgdir/usr/share/webapps/$pkgname/" # symlink .htaccess file into place - ln -sv "/etc/webapps/${pkgname}/.htaccess" "${pkgdir}/usr/share/webapps/${pkgname}/" + ln -sv /etc/webapps/$pkgname/.htaccess "$pkgdir/usr/share/webapps/$pkgname/" # add symlink to default writable apps directory - ln -sv "/var/lib/${pkgname}/apps" "${pkgdir}/usr/share/webapps/${pkgname}/wapps" + ln -sv /var/lib/$pkgname/apps "$pkgdir/usr/share/webapps/$pkgname/wapps" # install occ command - install -vDm 755 occ -t "${pkgdir}/usr/share/webapps/${pkgname}" + install -vDm 755 occ -t "$pkgdir/usr/share/webapps/$pkgname/" # occ script - install -vDm 755 "../${pkgname}.occ.sh" "${pkgdir}/usr/bin/occ" + install -vDm 755 ../custom_files/$pkgname.occ.sh "$pkgdir/usr/bin/occ" # optional pacman hook - install -vDm 644 "../${pkgname}.hook" -t "${pkgdir}/usr/share/doc/${pkgname}/" + install -vDm 644 ../$pkgname.hook -t "$pkgdir/usr/share/doc/$pkgname/" # apache example conf - install -vDm 644 ../apache.example.conf -t "${pkgdir}/usr/share/doc/${pkgname}/" - # systemd timer - install -vDm 644 ../${pkgname}-cron.{service,timer} -t "$pkgdir/usr/lib/systemd/system" + install -vDm 644 ../apache.example.conf -t "$pkgdir/usr/share/doc/$pkgname/" + # systemd service + install -vDm 644 ../custom_files/$pkgname-cron.service -t "$pkgdir/usr/lib/systemd/system/" + install -vDm 644 ../$pkgname-cron.timer -t "$pkgdir/usr/lib/systemd/system/" } Deleted: nextcloud-23.0.0-php8.1.patch =================================================================== --- nextcloud-23.0.0-php8.1.patch 2022-04-25 15:28:43 UTC (rev 1190022) +++ nextcloud-23.0.0-php8.1.patch 2022-04-25 16:05:33 UTC (rev 1190023) @@ -1,1664 +0,0 @@ -From 113756db30fcbffe9e90b54c29e78dee0676109f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chill...@nextcloud.com> -Date: Tue, 19 Oct 2021 17:11:53 +0200 -Subject: [PATCH] Fix ArrayAccess and JsonSerializable return types -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -First round of modifications for PHP 8.1 - -Signed-off-by: Côme Chilliet <come.chill...@nextcloud.com> ---- - apps/files_external/lib/Lib/Auth/AuthMechanism.php | 4 +--- - apps/files_external/lib/Lib/Backend/Backend.php | 4 +--- - .../files_external/lib/Lib/DefinitionParameter.php | 4 +--- - apps/files_external/lib/Lib/StorageConfig.php | 4 +--- - apps/theming/lib/Service/JSDataService.php | 2 +- - apps/user_status/lib/Service/JSDataService.php | 2 +- - core/Command/Broadcast/Test.php | 2 +- - lib/private/Accounts/Account.php | 3 ++- - lib/private/Accounts/AccountProperty.php | 2 +- - lib/private/Accounts/AccountPropertyCollection.php | 2 +- - lib/private/AppFramework/Http/Request.php | 5 +++-- - .../AppFramework/Utility/SimpleContainer.php | 8 +++++--- - lib/private/Authentication/Token/DefaultToken.php | 2 +- - .../Authentication/Token/PublicKeyToken.php | 2 +- - lib/private/Cache/CappedMemoryCache.php | 10 +++++++--- - .../Contacts/ContactsMenu/Actions/LinkAction.php | 5 +---- - .../EventDispatcher/GenericEventWrapper.php | 14 +++++++++----- - lib/private/Files/Cache/CacheEntry.php | 10 +++++++--- - lib/private/Files/FileInfo.php | 10 +++++++--- - lib/private/FullTextSearch/Model/IndexDocument.php | 4 +--- - .../Model/SearchRequestSimpleQuery.php | 3 +-- - lib/private/L10N/L10NString.php | 6 +----- - lib/private/Memcache/Cache.php | 10 +++++++--- - lib/private/Session/CryptoSessionData.php | 5 +++-- - lib/private/Session/Session.php | 5 +++-- - .../AppFramework/Services/InitialStateProvider.php | 2 ++ - lib/public/Dashboard/Model/WidgetSetting.php | 4 +--- - lib/public/Dashboard/Model/WidgetSetup.php | 4 +--- - lib/public/Dashboard/Model/WidgetTemplate.php | 4 +--- - lib/public/DirectEditing/ATemplate.php | 3 +-- - lib/public/EventDispatcher/GenericEvent.php | 2 ++ - lib/public/Files/Template/Template.php | 2 +- - lib/public/Files/Template/TemplateFileCreator.php | 2 +- - tests/lib/InitialStateServiceTest.php | 2 +- - 34 files changed, 79 insertions(+), 74 deletions(-) - -diff --git a/apps/files_external/lib/Lib/Auth/AuthMechanism.php b/apps/files_external/lib/Lib/Auth/AuthMechanism.php -index f676957794d8..210dd705723e 100644 ---- a/apps/files_external/lib/Lib/Auth/AuthMechanism.php -+++ b/apps/files_external/lib/Lib/Auth/AuthMechanism.php -@@ -90,10 +90,8 @@ public function setScheme($scheme) { - - /** - * Serialize into JSON for client-side JS -- * -- * @return array - */ -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - $data = $this->jsonSerializeDefinition(); - $data += $this->jsonSerializeIdentifier(); - -diff --git a/apps/files_external/lib/Lib/Backend/Backend.php b/apps/files_external/lib/Lib/Backend/Backend.php -index a6e63eb30d19..021d208aed33 100644 ---- a/apps/files_external/lib/Lib/Backend/Backend.php -+++ b/apps/files_external/lib/Lib/Backend/Backend.php -@@ -137,10 +137,8 @@ public function setLegacyAuthMechanismCallback(callable $callback) { - - /** - * Serialize into JSON for client-side JS -- * -- * @return array - */ -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - $data = $this->jsonSerializeDefinition(); - $data += $this->jsonSerializeIdentifier(); - -diff --git a/apps/files_external/lib/Lib/DefinitionParameter.php b/apps/files_external/lib/Lib/DefinitionParameter.php -index fbfbbfd4686a..6b081d5a089f 100644 ---- a/apps/files_external/lib/Lib/DefinitionParameter.php -+++ b/apps/files_external/lib/Lib/DefinitionParameter.php -@@ -167,10 +167,8 @@ public function setTooltip(string $tooltip) { - - /** - * Serialize into JSON for client-side JS -- * -- * @return string - */ -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'value' => $this->getText(), - 'flags' => $this->getFlags(), -diff --git a/apps/files_external/lib/Lib/StorageConfig.php b/apps/files_external/lib/Lib/StorageConfig.php -index 97b72005018d..26ba483b00ef 100644 ---- a/apps/files_external/lib/Lib/StorageConfig.php -+++ b/apps/files_external/lib/Lib/StorageConfig.php -@@ -396,10 +396,8 @@ public function setType($type) { - - /** - * Serialize config to JSON -- * -- * @return array - */ -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - $result = []; - if (!is_null($this->id)) { - $result['id'] = $this->id; -diff --git a/apps/theming/lib/Service/JSDataService.php b/apps/theming/lib/Service/JSDataService.php -index a6e5d6f8e365..1c4d138a7646 100644 ---- a/apps/theming/lib/Service/JSDataService.php -+++ b/apps/theming/lib/Service/JSDataService.php -@@ -50,7 +50,7 @@ public function __construct( - $this->appConfig = $appConfig; - } - -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'name' => $this->themingDefaults->getName(), - 'url' => $this->themingDefaults->getBaseUrl(), -diff --git a/apps/user_status/lib/Service/JSDataService.php b/apps/user_status/lib/Service/JSDataService.php -index 6d83591ab2f4..c08643ec64fb 100644 ---- a/apps/user_status/lib/Service/JSDataService.php -+++ b/apps/user_status/lib/Service/JSDataService.php -@@ -49,7 +49,7 @@ public function __construct(IUserSession $userSession, - $this->statusService = $statusService; - } - -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - $user = $this->userSession->getUser(); - - if ($user === null) { -diff --git a/core/Command/Broadcast/Test.php b/core/Command/Broadcast/Test.php -index 91050725e176..86cd30e4b4c6 100644 ---- a/core/Command/Broadcast/Test.php -+++ b/core/Command/Broadcast/Test.php -@@ -87,7 +87,7 @@ public function getUids(): array { - ]; - } - -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'description' => 'this is a test event', - ]; -diff --git a/lib/private/Accounts/Account.php b/lib/private/Accounts/Account.php -index 1e4189f2b35c..540d15cd4b9e 100644 ---- a/lib/private/Accounts/Account.php -+++ b/lib/private/Accounts/Account.php -@@ -104,7 +104,8 @@ public function getFilteredProperties(string $scope = null, string $verified = n - return $result; - } - -- public function jsonSerialize() { -+ /** @return IAccountPropertyCollection[]|IAccountProperty[] */ -+ public function jsonSerialize(): array { - return $this->properties; - } - -diff --git a/lib/private/Accounts/AccountProperty.php b/lib/private/Accounts/AccountProperty.php -index 0e6356e9e92e..4b7f2b0c04c2 100644 ---- a/lib/private/Accounts/AccountProperty.php -+++ b/lib/private/Accounts/AccountProperty.php -@@ -54,7 +54,7 @@ public function __construct(string $name, string $value, string $scope, string $ - $this->verificationData = $verificationData; - } - -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'name' => $this->getName(), - 'value' => $this->getValue(), -diff --git a/lib/private/Accounts/AccountPropertyCollection.php b/lib/private/Accounts/AccountPropertyCollection.php -index 3aed76d8746a..091c5734218b 100644 ---- a/lib/private/Accounts/AccountPropertyCollection.php -+++ b/lib/private/Accounts/AccountPropertyCollection.php -@@ -102,7 +102,7 @@ public function removePropertyByValue(string $value): IAccountPropertyCollection - return $this; - } - -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [$this->collectionName => $this->properties]; - } - -diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php -index a95fd208155c..c67500bcaa4e 100644 ---- a/lib/private/AppFramework/Http/Request.php -+++ b/lib/private/AppFramework/Http/Request.php -@@ -199,6 +199,7 @@ public function offsetExists($offset): bool { - * @param string $offset - * @return mixed - */ -+ #[\ReturnTypeWillChange] - public function offsetGet($offset) { - return isset($this->items['parameters'][$offset]) - ? $this->items['parameters'][$offset] -@@ -210,7 +211,7 @@ public function offsetGet($offset) { - * @param string $offset - * @param mixed $value - */ -- public function offsetSet($offset, $value) { -+ public function offsetSet($offset, $value): void { - throw new \RuntimeException('You cannot change the contents of the request object'); - } - -@@ -218,7 +219,7 @@ public function offsetSet($offset, $value) { - * @see offsetExists - * @param string $offset - */ -- public function offsetUnset($offset) { -+ public function offsetUnset($offset): void { - throw new \RuntimeException('You cannot change the contents of the request object'); - } - -diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php -index c38dbadf0a97..598c66b6aba7 100644 ---- a/lib/private/AppFramework/Utility/SimpleContainer.php -+++ b/lib/private/AppFramework/Utility/SimpleContainer.php -@@ -197,13 +197,15 @@ protected function sanitizeName($name) { - /** - * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::has - */ -- public function offsetExists($id) { -+ public function offsetExists($id): bool { - return $this->container->offsetExists($id); - } - - /** - * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get -+ * @return mixed - */ -+ #[\ReturnTypeWillChange] - public function offsetGet($id) { - return $this->container->offsetGet($id); - } -@@ -211,14 +213,14 @@ public function offsetGet($id) { - /** - * @deprecated 20.0.0 use \OCP\IContainer::registerService - */ -- public function offsetSet($id, $service) { -+ public function offsetSet($id, $service): void { - $this->container->offsetSet($id, $service); - } - - /** - * @deprecated 20.0.0 - */ -- public function offsetUnset($offset) { -+ public function offsetUnset($offset): void { - $this->container->offsetUnset($offset); - } - } -diff --git a/lib/private/Authentication/Token/DefaultToken.php b/lib/private/Authentication/Token/DefaultToken.php -index 5a008586a901..b649fdbb6aff 100644 ---- a/lib/private/Authentication/Token/DefaultToken.php -+++ b/lib/private/Authentication/Token/DefaultToken.php -@@ -121,7 +121,7 @@ public function getPassword() { - return parent::getPassword(); - } - -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'id' => $this->id, - 'name' => $this->name, -diff --git a/lib/private/Authentication/Token/PublicKeyToken.php b/lib/private/Authentication/Token/PublicKeyToken.php -index 3351c767ce3b..d060fe141032 100644 ---- a/lib/private/Authentication/Token/PublicKeyToken.php -+++ b/lib/private/Authentication/Token/PublicKeyToken.php -@@ -138,7 +138,7 @@ public function getPassword() { - return parent::getPassword(); - } - -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'id' => $this->id, - 'name' => $this->name, -diff --git a/lib/private/Cache/CappedMemoryCache.php b/lib/private/Cache/CappedMemoryCache.php -index 408c3935ffb9..584a53f0ff28 100644 ---- a/lib/private/Cache/CappedMemoryCache.php -+++ b/lib/private/Cache/CappedMemoryCache.php -@@ -63,19 +63,23 @@ public function clear($prefix = '') { - return true; - } - -- public function offsetExists($offset) { -+ public function offsetExists($offset): bool { - return $this->hasKey($offset); - } - -+ /** -+ * @return mixed -+ */ -+ #[\ReturnTypeWillChange] - public function &offsetGet($offset) { - return $this->cache[$offset]; - } - -- public function offsetSet($offset, $value) { -+ public function offsetSet($offset, $value): void { - $this->set($offset, $value); - } - -- public function offsetUnset($offset) { -+ public function offsetUnset($offset): void { - $this->remove($offset); - } - -diff --git a/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php b/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php -index 5acafed2fdaf..3f917854aac8 100644 ---- a/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php -+++ b/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php -@@ -106,10 +106,7 @@ public function getAppId(): string { - return $this->appId; - } - -- /** -- * @return array -- */ -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'title' => $this->name, - 'icon' => $this->icon, -diff --git a/lib/private/EventDispatcher/GenericEventWrapper.php b/lib/private/EventDispatcher/GenericEventWrapper.php -index 55e23d2ff7fa..3574bc8bb835 100644 ---- a/lib/private/EventDispatcher/GenericEventWrapper.php -+++ b/lib/private/EventDispatcher/GenericEventWrapper.php -@@ -100,19 +100,23 @@ public function hasArgument($key) { - return $this->event->hasArgument($key); - } - -+ /** -+ * @return mixed -+ */ -+ #[\ReturnTypeWillChange] - public function offsetGet($key) { - return $this->event->offsetGet($key); - } - -- public function offsetSet($key, $value) { -- return $this->event->offsetSet($key, $value); -+ public function offsetSet($key, $value): void { -+ $this->event->offsetSet($key, $value); - } - -- public function offsetUnset($key) { -- return $this->event->offsetUnset($key); -+ public function offsetUnset($key): void { -+ $this->event->offsetUnset($key); - } - -- public function offsetExists($key) { -+ public function offsetExists($key): bool { - return $this->event->offsetExists($key); - } - -diff --git a/lib/private/Files/Cache/CacheEntry.php b/lib/private/Files/Cache/CacheEntry.php -index 156f075c2d06..12f0273fb6e7 100644 ---- a/lib/private/Files/Cache/CacheEntry.php -+++ b/lib/private/Files/Cache/CacheEntry.php -@@ -37,18 +37,22 @@ public function __construct(array $data) { - $this->data = $data; - } - -- public function offsetSet($offset, $value) { -+ public function offsetSet($offset, $value): void { - $this->data[$offset] = $value; - } - -- public function offsetExists($offset) { -+ public function offsetExists($offset): bool { - return isset($this->data[$offset]); - } - -- public function offsetUnset($offset) { -+ public function offsetUnset($offset): void { - unset($this->data[$offset]); - } - -+ /** -+ * @return mixed -+ */ -+ #[\ReturnTypeWillChange] - public function offsetGet($offset) { - if (isset($this->data[$offset])) { - return $this->data[$offset]; -diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php -index 8a8de6e4c19b..2f361fc051db 100644 ---- a/lib/private/Files/FileInfo.php -+++ b/lib/private/Files/FileInfo.php -@@ -104,18 +104,22 @@ public function __construct($path, $storage, $internalPath, $data, $mount, $owne - $this->rawSize = $this->data['size'] ?? 0; - } - -- public function offsetSet($offset, $value) { -+ public function offsetSet($offset, $value): void { - $this->data[$offset] = $value; - } - -- public function offsetExists($offset) { -+ public function offsetExists($offset): bool { - return isset($this->data[$offset]); - } - -- public function offsetUnset($offset) { -+ public function offsetUnset($offset): void { - unset($this->data[$offset]); - } - -+ /** -+ * @return mixed -+ */ -+ #[\ReturnTypeWillChange] - public function offsetGet($offset) { - if ($offset === 'type') { - return $this->getType(); -diff --git a/lib/private/FullTextSearch/Model/IndexDocument.php b/lib/private/FullTextSearch/Model/IndexDocument.php -index a1648ab6e2ab..3078f12c4653 100644 ---- a/lib/private/FullTextSearch/Model/IndexDocument.php -+++ b/lib/private/FullTextSearch/Model/IndexDocument.php -@@ -963,10 +963,8 @@ public function __destruct() { - - /** - * @since 15.0.0 -- * -- * @return array - */ -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'id' => $this->getId(), - 'providerId' => $this->getProviderId(), -diff --git a/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php b/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php -index 9c9ac71efa95..d6bfe6d91023 100644 ---- a/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php -+++ b/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php -@@ -168,10 +168,9 @@ public function addValueBool(bool $value): ISearchRequestSimpleQuery { - - - /** -- * @return array|mixed - * @since 17.0.0 - */ -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'type' => $this->getType(), - 'field' => $this->getField(), -diff --git a/lib/private/L10N/L10NString.php b/lib/private/L10N/L10NString.php -index 33ccc4b14096..de4bc38d7442 100644 ---- a/lib/private/L10N/L10NString.php -+++ b/lib/private/L10N/L10NString.php -@@ -82,11 +82,7 @@ public function __toString(): string { - return vsprintf($text, $this->parameters); - } - -- -- /** -- * @return string -- */ -- public function jsonSerialize() { -+ public function jsonSerialize(): string { - return $this->__toString(); - } - } -diff --git a/lib/private/Memcache/Cache.php b/lib/private/Memcache/Cache.php -index 95213c168497..1d54a705098e 100644 ---- a/lib/private/Memcache/Cache.php -+++ b/lib/private/Memcache/Cache.php -@@ -78,19 +78,23 @@ abstract public function clear($prefix = ''); - - //implement the ArrayAccess interface - -- public function offsetExists($offset) { -+ public function offsetExists($offset): bool { - return $this->hasKey($offset); - } - -- public function offsetSet($offset, $value) { -+ public function offsetSet($offset, $value): void { - $this->set($offset, $value); - } - -+ /** -+ * @return mixed -+ */ -+ #[\ReturnTypeWillChange] - public function offsetGet($offset) { - return $this->get($offset); - } - -- public function offsetUnset($offset) { -+ public function offsetUnset($offset): void { - $this->remove($offset); - } - } -diff --git a/lib/private/Session/CryptoSessionData.php b/lib/private/Session/CryptoSessionData.php -index 94ad8f90dcfd..2e3bd46da5b4 100644 ---- a/lib/private/Session/CryptoSessionData.php -+++ b/lib/private/Session/CryptoSessionData.php -@@ -195,6 +195,7 @@ public function offsetExists($offset): bool { - * @param mixed $offset - * @return mixed - */ -+ #[\ReturnTypeWillChange] - public function offsetGet($offset) { - return $this->get($offset); - } -@@ -203,14 +204,14 @@ public function offsetGet($offset) { - * @param mixed $offset - * @param mixed $value - */ -- public function offsetSet($offset, $value) { -+ public function offsetSet($offset, $value): void { - $this->set($offset, $value); - } - - /** - * @param mixed $offset - */ -- public function offsetUnset($offset) { -+ public function offsetUnset($offset): void { - $this->remove($offset); - } - } -diff --git a/lib/private/Session/Session.php b/lib/private/Session/Session.php -index b9497983fbb0..affba322bec7 100644 ---- a/lib/private/Session/Session.php -+++ b/lib/private/Session/Session.php -@@ -55,6 +55,7 @@ public function offsetExists($offset): bool { - * @param mixed $offset - * @return mixed - */ -+ #[\ReturnTypeWillChange] - public function offsetGet($offset) { - return $this->get($offset); - } -@@ -63,14 +64,14 @@ public function offsetGet($offset) { - * @param mixed $offset - * @param mixed $value - */ -- public function offsetSet($offset, $value) { -+ public function offsetSet($offset, $value): void { - $this->set($offset, $value); - } - - /** - * @param mixed $offset - */ -- public function offsetUnset($offset) { -+ public function offsetUnset($offset): void { - $this->remove($offset); - } - -diff --git a/lib/public/AppFramework/Services/InitialStateProvider.php b/lib/public/AppFramework/Services/InitialStateProvider.php -index c317fad3f5de..dbc486537924 100644 ---- a/lib/public/AppFramework/Services/InitialStateProvider.php -+++ b/lib/public/AppFramework/Services/InitialStateProvider.php -@@ -42,7 +42,9 @@ abstract public function getData(); - - /** - * @since 21.0.0 -+ * @return mixed - */ -+ #[\ReturnTypeWillChange] - final public function jsonSerialize() { - return $this->getData(); - } -diff --git a/lib/public/Dashboard/Model/WidgetSetting.php b/lib/public/Dashboard/Model/WidgetSetting.php -index c456c63f4f58..fce59a4350b6 100644 ---- a/lib/public/Dashboard/Model/WidgetSetting.php -+++ b/lib/public/Dashboard/Model/WidgetSetting.php -@@ -230,10 +230,8 @@ public function getDefault(): string { - /** - * @since 15.0.0 - * @deprecated 20.0.0 -- * -- * @return array - */ -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'name' => $this->getName(), - 'title' => $this->getTitle(), -diff --git a/lib/public/Dashboard/Model/WidgetSetup.php b/lib/public/Dashboard/Model/WidgetSetup.php -index 1cc8d9ff561b..f3e09dcc71b1 100644 ---- a/lib/public/Dashboard/Model/WidgetSetup.php -+++ b/lib/public/Dashboard/Model/WidgetSetup.php -@@ -261,10 +261,8 @@ public function setDefaultSettings(array $settings): WidgetSetup { - /** - * @since 15.0.0 - * @deprecated 20.0.0 -- * -- * @return array - */ -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'size' => $this->getSizes(), - 'menu' => $this->getMenuEntries(), -diff --git a/lib/public/Dashboard/Model/WidgetTemplate.php b/lib/public/Dashboard/Model/WidgetTemplate.php -index e6f9742fed7a..3521960c303c 100644 ---- a/lib/public/Dashboard/Model/WidgetTemplate.php -+++ b/lib/public/Dashboard/Model/WidgetTemplate.php -@@ -312,10 +312,8 @@ public function getSetting(string $key): WidgetSetting { - /** - * @since 15.0.0 - * @deprecated 20.0.0 -- * -- * @return array - */ -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'icon' => $this->getIcon(), - 'css' => $this->getCss(), -diff --git a/lib/public/DirectEditing/ATemplate.php b/lib/public/DirectEditing/ATemplate.php -index c38fc898dab4..53aff0d40ffe 100644 ---- a/lib/public/DirectEditing/ATemplate.php -+++ b/lib/public/DirectEditing/ATemplate.php -@@ -57,9 +57,8 @@ abstract public function getPreview(): string; - - /** - * @since 18.0.0 -- * @return array|mixed - */ -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'id' => $this->getId(), - 'title' => $this->getTitle(), -diff --git a/lib/public/EventDispatcher/GenericEvent.php b/lib/public/EventDispatcher/GenericEvent.php -index e78ae1827a16..1ba1cc6da14f 100644 ---- a/lib/public/EventDispatcher/GenericEvent.php -+++ b/lib/public/EventDispatcher/GenericEvent.php -@@ -156,7 +156,9 @@ public function offsetExists($offset): bool { - * @link https://php.net/manual/en/arrayaccess.offsetget.php - * @since 18.0.0 - * @deprecated 22.0.0 -+ * @return mixed - */ -+ #[\ReturnTypeWillChange] - public function offsetGet($offset) { - return $this->arguments[$offset]; - } -diff --git a/lib/public/Files/Template/Template.php b/lib/public/Files/Template/Template.php -index 50d8b406be9c..d71ef3b3655d 100644 ---- a/lib/public/Files/Template/Template.php -+++ b/lib/public/Files/Template/Template.php -@@ -69,7 +69,7 @@ public function setHasPreview(bool $hasPreview): void { - /** - * @since 21.0.0 - */ -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'templateType' => $this->templateType, - 'templateId' => $this->templateId, -diff --git a/lib/public/Files/Template/TemplateFileCreator.php b/lib/public/Files/Template/TemplateFileCreator.php -index 7be45e68ef9f..26edf585869d 100644 ---- a/lib/public/Files/Template/TemplateFileCreator.php -+++ b/lib/public/Files/Template/TemplateFileCreator.php -@@ -106,7 +106,7 @@ public function getOrder(): int { - /** - * @since 21.0.0 - */ -- public function jsonSerialize() { -+ public function jsonSerialize(): array { - return [ - 'app' => $this->appId, - 'label' => $this->actionName, - -From 260be93a14af6eccb6240dfb3692073775da259e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chill...@nextcloud.com> -Date: Tue, 19 Oct 2021 17:08:57 +0200 -Subject: [PATCH 01/12] Allow running Nextcloud with PHP 8.1 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Côme Chilliet <come.chill...@nextcloud.com> ---- - lib/versioncheck.php | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/lib/versioncheck.php b/lib/versioncheck.php -index 4b1d9dec4d72..8aa68dd35fdd 100644 ---- a/lib/versioncheck.php -+++ b/lib/versioncheck.php -@@ -33,10 +33,10 @@ - exit(1); - } - --// Show warning if > PHP 8.0 is used as Nextcloud is not compatible with > PHP 8.0 for now --if (PHP_VERSION_ID >= 80100) { -+// Show warning if > PHP 8.1 is used as Nextcloud is not compatible with > PHP 8.1 for now -+if (PHP_VERSION_ID > 80100) { - http_response_code(500); -- echo 'This version of Nextcloud is not compatible with > PHP 8.0.<br/>'; -+ echo 'This version of Nextcloud is not compatible with > PHP 8.1.<br/>'; - echo 'You are currently running ' . PHP_VERSION . '.'; - exit(1); - } - -From 37f8f7a5a18e57507330036b747d4b12e58efae4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chill...@nextcloud.com> -Date: Tue, 26 Oct 2021 16:42:19 +0200 -Subject: [PATCH 03/12] Fix tests on PHP 8.1 for encryption, files_sharing, - files_version, -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - - files_trashbin and theming apps - -Signed-off-by: Côme Chilliet <come.chill...@nextcloud.com> ---- - apps/encryption/lib/Command/FixEncryptedVersion.php | 5 +---- - apps/encryption/tests/Crypto/EncryptAllTest.php | 5 ++++- - .../tests/Controller/PublicPreviewControllerTest.php | 4 ++++ - .../tests/Controller/PreviewControllerTest.php | 2 ++ - .../tests/Controller/PreviewControllerTest.php | 2 ++ - apps/theming/tests/Controller/IconControllerTest.php | 2 ++ - apps/theming/tests/Controller/ThemingControllerTest.php | 3 +++ - 7 files changed, 18 insertions(+), 5 deletions(-) - -diff --git a/apps/encryption/lib/Command/FixEncryptedVersion.php b/apps/encryption/lib/Command/FixEncryptedVersion.php -index d51f64c8ef91..073c1f1438a8 100644 ---- a/apps/encryption/lib/Command/FixEncryptedVersion.php -+++ b/apps/encryption/lib/Command/FixEncryptedVersion.php -@@ -116,10 +116,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int - $user = (string)$input->getArgument('user'); - $pathToWalk = "/$user/files"; - -- /** -- * trim() returns an empty string when the argument is an unset/null -- */ -- $pathOption = \trim($input->getOption('path'), '/'); -+ $pathOption = \trim(($input->getOption('path') ?? ''), '/'); - if ($pathOption !== "") { - $pathToWalk = "$pathToWalk/$pathOption"; - } - -From f3dcbfe146782d2c7dec8760651e79605ddc96e7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chill...@nextcloud.com> -Date: Tue, 26 Oct 2021 16:43:39 +0200 -Subject: [PATCH 04/12] Fix PHP 8.1 support for user_ldap application -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Côme Chilliet <come.chill...@nextcloud.com> ---- - apps/user_ldap/lib/Access.php | 8 +- - apps/user_ldap/lib/Connection.php | 9 +- - apps/user_ldap/lib/Group_LDAP.php | 6 +- - apps/user_ldap/lib/Group_Proxy.php | 2 +- - apps/user_ldap/lib/IGroupLDAP.php | 2 +- - apps/user_ldap/lib/ILDAPWrapper.php | 60 ++++++------ - apps/user_ldap/lib/IUserLDAP.php | 2 +- - apps/user_ldap/lib/LDAP.php | 92 +++++-------------- - apps/user_ldap/lib/LDAPProvider.php | 4 +- - apps/user_ldap/lib/PagedResults/IAdapter.php | 4 +- - apps/user_ldap/lib/PagedResults/TLinkId.php | 12 ++- - apps/user_ldap/lib/User/Manager.php | 2 +- - apps/user_ldap/lib/User/User.php | 8 +- - apps/user_ldap/lib/User_LDAP.php | 2 +- - apps/user_ldap/lib/User_Proxy.php | 2 +- - apps/user_ldap/lib/Wizard.php | 6 +- - apps/user_ldap/tests/AccessTest.php | 2 +- - .../Integration/ExceptionOnLostConnection.php | 4 +- - 18 files changed, 96 insertions(+), 131 deletions(-) - -diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php -index 0af04747ded2..f79efe909968 100644 ---- a/apps/user_ldap/lib/Access.php -+++ b/apps/user_ldap/lib/Access.php -@@ -260,7 +260,7 @@ public function readAttribute($dn, $attr, $filter = 'objectClass=*') { - /** - * Runs an read operation against LDAP - * -- * @param resource $cr the LDAP connection -+ * @param resource|\LDAP\Connection $cr the LDAP connection - * @param string $dn - * @param string $attribute - * @param string $filter -@@ -926,7 +926,7 @@ public function fetchListOfUsers(string $filter, array $attr, int $limit = null, - * @throws \Exception - */ - public function batchApplyUserAttributes(array $ldapRecords) { -- $displayNameAttribute = strtolower($this->connection->ldapUserDisplayName); -+ $displayNameAttribute = strtolower((string)$this->connection->ldapUserDisplayName); - foreach ($ldapRecords as $userRecord) { - if (!isset($userRecord[$displayNameAttribute])) { - // displayName is obligatory -@@ -1186,7 +1186,7 @@ private function executeSearch( - /** - * processes an LDAP paged search operation - * -- * @param resource $sr the array containing the LDAP search resources -+ * @param resource|\LDAP\Result|resource[]|\LDAP\Result[] $sr the array containing the LDAP search resources - * @param int $foundItems number of results in the single search operation - * @param int $limit maximum results to be counted - * @param bool $pagedSearchOK whether a paged search has been executed -@@ -1303,7 +1303,7 @@ private function count( - } - - /** -- * @param resource $sr -+ * @param resource|\LDAP\Result|resource[]|\LDAP\Result[] $sr - * @return int - * @throws ServerNotAvailableException - */ -diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php -index 77ae34f9f6c4..6666da1e933c 100644 ---- a/apps/user_ldap/lib/Connection.php -+++ b/apps/user_ldap/lib/Connection.php -@@ -74,6 +74,9 @@ - * @property string ldapMatchingRuleInChainState - */ - class Connection extends LDAPUtility { -+ /** -+ * @var resource|\LDAP\Connection|null -+ */ - private $ldapConnectionRes = null; - private $configPrefix; - private $configID; -@@ -202,7 +205,7 @@ public function init($force = false) { - } - - /** -- * Returns the LDAP handler -+ * @return resource|\LDAP\Connection The LDAP resource - */ - public function getConnectionResource() { - if (!$this->ldapConnectionRes) { -@@ -408,7 +411,7 @@ private function doSoftValidation() { - } - } - -- if ((stripos($this->configuration->ldapHost, 'ldaps://') === 0) -+ if ((stripos((string)$this->configuration->ldapHost, 'ldaps://') === 0) - && $this->configuration->ldapTLS) { - $this->configuration->ldapTLS = false; - $this->logger->info( -@@ -487,7 +490,7 @@ private function doCriticalValidation() { - $configurationOK = false; - } - -- if (mb_strpos($this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8') -+ if (mb_strpos((string)$this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8') - === false) { - $this->logger->warning( - $errorStr.'login filter does not contain %uid place holder.', -diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php -index 744f921c6dd3..9172b5fa25fc 100644 ---- a/apps/user_ldap/lib/Group_LDAP.php -+++ b/apps/user_ldap/lib/Group_LDAP.php -@@ -83,7 +83,7 @@ public function __construct(Access $access, GroupPluginManager $groupPluginManag - $this->cachedNestedGroups = new CappedMemoryCache(); - $this->groupPluginManager = $groupPluginManager; - $this->logger = OC::$server->get(LoggerInterface::class); -- $this->ldapGroupMemberAssocAttr = strtolower($gAssoc); -+ $this->ldapGroupMemberAssocAttr = strtolower((string)$gAssoc); - } - - /** -@@ -202,7 +202,7 @@ public function inGroup($uid, $gid) { - * @throws ServerNotAvailableException - */ - public function getDynamicGroupMembers(string $dnGroup): array { -- $dynamicGroupMemberURL = strtolower($this->access->connection->ldapDynamicGroupMemberURL); -+ $dynamicGroupMemberURL = strtolower((string)$this->access->connection->ldapDynamicGroupMemberURL); - - if (empty($dynamicGroupMemberURL)) { - return []; -@@ -1312,7 +1312,7 @@ public function getGroupDetails($gid) { - * of the current access. - * - * @param string $gid -- * @return resource of the LDAP connection -+ * @return resource|\LDAP\Connection The LDAP connection - * @throws ServerNotAvailableException - */ - public function getNewLDAPConnection($gid) { -diff --git a/apps/user_ldap/lib/Group_Proxy.php b/apps/user_ldap/lib/Group_Proxy.php -index 3f9bb9013eb4..92a9041949e2 100644 ---- a/apps/user_ldap/lib/Group_Proxy.php -+++ b/apps/user_ldap/lib/Group_Proxy.php -@@ -290,7 +290,7 @@ public function getLDAPAccess($gid) { - * The connection needs to be closed manually. - * - * @param string $gid -- * @return resource of the LDAP connection -+ * @return resource|\LDAP\Connection The LDAP connection - */ - public function getNewLDAPConnection($gid) { - return $this->handleRequest($gid, 'getNewLDAPConnection', [$gid]); -diff --git a/apps/user_ldap/lib/IGroupLDAP.php b/apps/user_ldap/lib/IGroupLDAP.php -index 33636dd8f552..2face1aa9074 100644 ---- a/apps/user_ldap/lib/IGroupLDAP.php -+++ b/apps/user_ldap/lib/IGroupLDAP.php -@@ -36,7 +36,7 @@ public function getLDAPAccess($gid); - /** - * Return a new LDAP connection for the specified group. - * @param string $gid -- * @return resource of the LDAP connection -+ * @return resource|\LDAP\Connection The LDAP connection - */ - public function getNewLDAPConnection($gid); - } -diff --git a/apps/user_ldap/lib/ILDAPWrapper.php b/apps/user_ldap/lib/ILDAPWrapper.php -index c82df09d2345..9917898a001b 100644 ---- a/apps/user_ldap/lib/ILDAPWrapper.php -+++ b/apps/user_ldap/lib/ILDAPWrapper.php -@@ -35,7 +35,7 @@ interface ILDAPWrapper { - - /** - * Bind to LDAP directory -- * @param resource $link LDAP link resource -+ * @param resource|\LDAP\Connection $link LDAP link resource - * @param string $dn an RDN to log in with - * @param string $password the password - * @return bool true on success, false otherwise -@@ -54,7 +54,7 @@ public function connect($host, $port); - - /** - * Send LDAP pagination control -- * @param resource $link LDAP link resource -+ * @param resource|\LDAP\Connection $link LDAP link resource - * @param int $pageSize number of results per page - * @param bool $isCritical Indicates whether the pagination is critical of not. - * @param string $cookie structure sent by LDAP server -@@ -64,8 +64,8 @@ public function controlPagedResult($link, $pageSize, $isCritical); - - /** - * Retrieve the LDAP pagination cookie -- * @param resource $link LDAP link resource -- * @param resource $result LDAP result resource -+ * @param resource|\LDAP\Connection $link LDAP link resource -+ * @param resource|\LDAP\Result $result LDAP result resource - * @param string $cookie structure sent by LDAP server - * @return bool true on success, false otherwise - * -@@ -75,22 +75,22 @@ public function controlPagedResultResponse($link, $result, &$cookie); - - /** - * Count the number of entries in a search -- * @param resource $link LDAP link resource -- * @param resource $result LDAP result resource -+ * @param resource|\LDAP\Connection $link LDAP link resource -+ * @param resource|\LDAP\Result $result LDAP result resource - * @return int|false number of results on success, false otherwise - */ - public function countEntries($link, $result); - - /** - * Return the LDAP error number of the last LDAP command -- * @param resource $link LDAP link resource -+ * @param resource|\LDAP\Connection $link LDAP link resource - * @return int error code - */ - public function errno($link); - - /** - * Return the LDAP error message of the last LDAP command -- * @param resource $link LDAP link resource -+ * @param resource|\LDAP\Connection $link LDAP link resource - * @return string error message - */ - public function error($link); -@@ -106,69 +106,69 @@ public function explodeDN($dn, $withAttrib); - - /** - * Return first result id -- * @param resource $link LDAP link resource -- * @param resource $result LDAP result resource -- * @return Resource an LDAP search result resource -+ * @param resource|\LDAP\Connection $link LDAP link resource -+ * @param resource|\LDAP\Result $result LDAP result resource -+ * @return resource|\LDAP\ResultEntry an LDAP entry resource - * */ - public function firstEntry($link, $result); - - /** - * Get attributes from a search result entry -- * @param resource $link LDAP link resource -- * @param resource $result LDAP result resource -+ * @param resource|\LDAP\Connection $link LDAP link resource -+ * @param resource|\LDAP\ResultEntry $result LDAP result resource - * @return array containing the results, false on error - * */ - public function getAttributes($link, $result); - - /** - * Get the DN of a result entry -- * @param resource $link LDAP link resource -- * @param resource $result LDAP result resource -+ * @param resource|\LDAP\Connection $link LDAP link resource -+ * @param resource|\LDAP\ResultEntry $result LDAP result resource - * @return string containing the DN, false on error - */ - public function getDN($link, $result); - - /** - * Get all result entries -- * @param resource $link LDAP link resource -- * @param resource $result LDAP result resource -+ * @param resource|\LDAP\Connection $link LDAP link resource -+ * @param resource|\LDAP\Result $result LDAP result resource - * @return array containing the results, false on error - */ - public function getEntries($link, $result); - - /** - * Return next result id -- * @param resource $link LDAP link resource -- * @param resource $result LDAP entry result resource -- * @return resource an LDAP search result resource -+ * @param resource|\LDAP\Connection $link LDAP link resource -+ * @param resource|\LDAP\ResultEntry $result LDAP result resource -+ * @return resource|\LDAP\ResultEntry an LDAP entry resource - * */ - public function nextEntry($link, $result); - - /** - * Read an entry -- * @param resource $link LDAP link resource -+ * @param resource|\LDAP\Connection $link LDAP link resource - * @param array $baseDN The DN of the entry to read from - * @param string $filter An LDAP filter - * @param array $attr array of the attributes to read -- * @return resource an LDAP search result resource -+ * @return resource|\LDAP\Result an LDAP search result resource - */ - public function read($link, $baseDN, $filter, $attr); - - /** - * Search LDAP tree -- * @param resource $link LDAP link resource -+ * @param resource|\LDAP\Connection $link LDAP link resource - * @param string $baseDN The DN of the entry to read from - * @param string $filter An LDAP filter - * @param array $attr array of the attributes to read - * @param int $attrsOnly optional, 1 if only attribute types shall be returned - * @param int $limit optional, limits the result entries -- * @return resource|false an LDAP search result resource, false on error -+ * @return resource|\LDAP\Result|false an LDAP search result resource, false on error - */ - public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0); - - /** - * Replace the value of a userPassword by $password -- * @param resource $link LDAP link resource -+ * @param resource|\LDAP\Connection $link LDAP link resource - * @param string $userDN the DN of the user whose password is to be replaced - * @param string $password the new value for the userPassword - * @return bool true on success, false otherwise -@@ -177,7 +177,7 @@ public function modReplace($link, $userDN, $password); - - /** - * Sets the value of the specified option to be $value -- * @param resource $link LDAP link resource -+ * @param resource|\LDAP\Connection $link LDAP link resource - * @param string $option a defined LDAP Server option - * @param int $value the new value for the option - * @return bool true on success, false otherwise -@@ -186,14 +186,14 @@ public function setOption($link, $option, $value); - - /** - * establish Start TLS -- * @param resource $link LDAP link resource -+ * @param resource|\LDAP\Connection $link LDAP link resource - * @return bool true on success, false otherwise - */ - public function startTls($link); - - /** - * Unbind from LDAP directory -- * @param resource $link LDAP link resource -+ * @param resource|\LDAP\Connection $link LDAP link resource - * @return bool true on success, false otherwise - */ - public function unbind($link); -@@ -208,8 +208,8 @@ public function areLDAPFunctionsAvailable(); - - /** - * Checks whether the submitted parameter is a resource -- * @param resource $resource the resource variable to check -- * @return bool true if it is a resource, false otherwise -+ * @param mixed $resource the resource variable to check -+ * @return bool true if it is a resource or LDAP object, false otherwise - */ - public function isResource($resource); - } -diff --git a/apps/user_ldap/lib/IUserLDAP.php b/apps/user_ldap/lib/IUserLDAP.php -index 201bbfd75a22..dfba11c5d343 100644 ---- a/apps/user_ldap/lib/IUserLDAP.php -+++ b/apps/user_ldap/lib/IUserLDAP.php -@@ -37,7 +37,7 @@ public function getLDAPAccess($uid); - /** - * Return a new LDAP connection for the specified user. - * @param string $uid -- * @return resource of the LDAP connection -+ * @return resource|\LDAP\Connection of the LDAP connection - */ - public function getNewLDAPConnection($uid); - -diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php -index 900f5a7030f7..e33facd0889e 100644 ---- a/apps/user_ldap/lib/LDAP.php -+++ b/apps/user_ldap/lib/LDAP.php -@@ -51,19 +51,14 @@ public function __construct(string $logFile = '') { - } - - /** -- * @param resource $link -- * @param string $dn -- * @param string $password -- * @return bool|mixed -+ * {@inheritDoc} - */ - public function bind($link, $dn, $password) { - return $this->invokeLDAPMethod('bind', $link, $dn, $password); - } - - /** -- * @param string $host -- * @param string $port -- * @return mixed -+ * {@inheritDoc} - */ - public function connect($host, $port) { - if (strpos($host, '://') === false) { -@@ -76,6 +71,9 @@ public function connect($host, $port) { - return $this->invokeLDAPMethod('connect', $host); - } - -+ /** -+ * {@inheritDoc} -+ */ - public function controlPagedResultResponse($link, $result, &$cookie): bool { - $this->preFunctionCall( - $this->pagedResultsAdapter->getResponseCallFunc(), -@@ -93,10 +91,7 @@ public function controlPagedResultResponse($link, $result, &$cookie): bool { - } - - /** -- * @param LDAP $link -- * @param int $pageSize -- * @param bool $isCritical -- * @return mixed|true -+ * {@inheritDoc} - */ - public function controlPagedResult($link, $pageSize, $isCritical) { - $fn = $this->pagedResultsAdapter->getRequestCallFunc(); -@@ -116,25 +111,21 @@ public function controlPagedResult($link, $pageSize, $isCritical) { - } - - /** -- * @param LDAP $link -- * @param LDAP $result -- * @return mixed -+ * {@inheritDoc} - */ - public function countEntries($link, $result) { - return $this->invokeLDAPMethod('count_entries', $link, $result); - } - - /** -- * @param LDAP $link -- * @return integer -+ * {@inheritDoc} - */ - public function errno($link) { - return $this->invokeLDAPMethod('errno', $link); - } - - /** -- * @param LDAP $link -- * @return string -+ * {@inheritDoc} - */ - public function error($link) { - return $this->invokeLDAPMethod('error', $link); -@@ -152,56 +143,42 @@ public function explodeDN($dn, $withAttrib) { - } - - /** -- * @param LDAP $link -- * @param LDAP $result -- * @return mixed -+ * {@inheritDoc} - */ - public function firstEntry($link, $result) { - return $this->invokeLDAPMethod('first_entry', $link, $result); - } - - /** -- * @param LDAP $link -- * @param LDAP $result -- * @return array|mixed -+ * {@inheritDoc} - */ - public function getAttributes($link, $result) { - return $this->invokeLDAPMethod('get_attributes', $link, $result); - } - - /** -- * @param LDAP $link -- * @param LDAP $result -- * @return mixed|string -+ * {@inheritDoc} - */ - public function getDN($link, $result) { - return $this->invokeLDAPMethod('get_dn', $link, $result); - } - - /** -- * @param LDAP $link -- * @param LDAP $result -- * @return array|mixed -+ * {@inheritDoc} - */ - public function getEntries($link, $result) { - return $this->invokeLDAPMethod('get_entries', $link, $result); - } - - /** -- * @param LDAP $link -- * @param resource $result -- * @return mixed -+ * {@inheritDoc} - */ - public function nextEntry($link, $result) { - return $this->invokeLDAPMethod('next_entry', $link, $result); - } - - /** -- * @param LDAP $link -- * @param string $baseDN -- * @param string $filter -- * @param array $attr -- * @return mixed -+ * {@inheritDoc} - */ - public function read($link, $baseDN, $filter, $attr) { - $this->pagedResultsAdapter->setReadArgs($link, $baseDN, $filter, $attr); -@@ -209,14 +186,7 @@ public function read($link, $baseDN, $filter, $attr) { - } - - /** -- * @param LDAP $link -- * @param string[] $baseDN -- * @param string $filter -- * @param array $attr -- * @param int $attrsOnly -- * @param int $limit -- * @return mixed -- * @throws \Exception -+ * {@inheritDoc} - */ - public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0) { - $oldHandler = set_error_handler(function ($no, $message, $file, $line) use (&$oldHandler) { -@@ -239,47 +209,35 @@ public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = - } - - /** -- * @param LDAP $link -- * @param string $userDN -- * @param string $password -- * @return bool -+ * {@inheritDoc} - */ - public function modReplace($link, $userDN, $password) { - return $this->invokeLDAPMethod('mod_replace', $link, $userDN, ['userPassword' => $password]); - } - - /** -- * @param LDAP $link -- * @param string $userDN -- * @param string $oldPassword -- * @param string $password -- * @return bool -+ * {@inheritDoc} - */ - public function exopPasswd($link, $userDN, $oldPassword, $password) { - return $this->invokeLDAPMethod('exop_passwd', $link, $userDN, $oldPassword, $password); - } - - /** -- * @param LDAP $link -- * @param string $option -- * @param int $value -- * @return bool|mixed -+ * {@inheritDoc} - */ - public function setOption($link, $option, $value) { - return $this->invokeLDAPMethod('set_option', $link, $option, $value); - } - - /** -- * @param LDAP $link -- * @return mixed|true -+ * {@inheritDoc} - */ - public function startTls($link) { - return $this->invokeLDAPMethod('start_tls', $link); - } - - /** -- * @param resource $link -- * @return bool|mixed -+ * {@inheritDoc} - */ - public function unbind($link) { - return $this->invokeLDAPMethod('unbind', $link); -@@ -294,12 +252,10 @@ public function areLDAPFunctionsAvailable() { - } - - /** -- * Checks whether the submitted parameter is a resource -- * @param Resource $resource the resource variable to check -- * @return bool true if it is a resource, false otherwise -+ * {@inheritDoc} - */ - public function isResource($resource) { -- return is_resource($resource); -+ return is_resource($resource) || is_object($resource); - } - - /** -@@ -368,7 +324,7 @@ private function preFunctionCall($functionName, $args) { - /** - * Analyzes the returned LDAP error and acts accordingly if not 0 - * -- * @param resource $resource the LDAP Connection resource -+ * @param resource|\LDAP\Connection $resource the LDAP Connection resource - * @throws ConstraintViolationException - * @throws ServerNotAvailableException - * @throws \Exception -diff --git a/apps/user_ldap/lib/LDAPProvider.php b/apps/user_ldap/lib/LDAPProvider.php -index dd86ce486ac9..751ebf687684 100644 ---- a/apps/user_ldap/lib/LDAPProvider.php -+++ b/apps/user_ldap/lib/LDAPProvider.php -@@ -149,7 +149,7 @@ public function sanitizeDN($dn) { - * Return a new LDAP connection resource for the specified user. - * The connection must be closed manually. - * @param string $uid user id -- * @return resource of the LDAP connection -+ * @return resource|\LDAP\Connection The LDAP connection - * @throws \Exception if user id was not found in LDAP - */ - public function getLDAPConnection($uid) { -@@ -163,7 +163,7 @@ public function getLDAPConnection($uid) { - * Return a new LDAP connection resource for the specified user. - * The connection must be closed manually. - * @param string $gid group id -- * @return resource of the LDAP connection -+ * @return resource|\LDAP\Connection The LDAP connection - * @throws \Exception if group id was not found in LDAP - */ - public function getGroupLDAPConnection($gid) { -diff --git a/apps/user_ldap/lib/PagedResults/IAdapter.php b/apps/user_ldap/lib/PagedResults/IAdapter.php -index 2dd9ffe80a16..31338126e405 100644 ---- a/apps/user_ldap/lib/PagedResults/IAdapter.php -+++ b/apps/user_ldap/lib/PagedResults/IAdapter.php -@@ -82,7 +82,7 @@ public function getResponseCallArgs(array $originalArgs): array; - /** - * the adapter should do it's LDAP function call and return success state - * -- * @param resource $link LDAP resource -+ * @param resource|\LDAP\Connection $link LDAP resource - * @return bool - */ - public function responseCall($link): bool; -@@ -123,7 +123,7 @@ public function getReadArgs($link): array; - /** - * Returns the current paged results cookie - * -- * @param resource $link LDAP resource -+ * @param resource|\LDAP\Connection $link LDAP resource - * @return string - */ - public function getCookie($link): string; -diff --git a/apps/user_ldap/lib/PagedResults/TLinkId.php b/apps/user_ldap/lib/PagedResults/TLinkId.php -index 6f320705e67e..02c36da97f92 100644 ---- a/apps/user_ldap/lib/PagedResults/TLinkId.php -+++ b/apps/user_ldap/lib/PagedResults/TLinkId.php -@@ -28,10 +28,16 @@ - - trait TLinkId { - public function getLinkId($link) { -- if (is_resource($link)) { -+ if (is_object($link)) { -+ return spl_object_id($link); -+ } elseif (is_resource($link)) { - return (int)$link; -- } elseif (is_array($link) && isset($link[0]) && is_resource($link[0])) { -- return (int)$link[0]; -+ } elseif (is_array($link) && isset($link[0])) { -+ if (is_object($link[0])) { -+ return spl_object_id($link[0]); -+ } elseif (is_resource($link[0])) { -+ return (int)$link[0]; -+ } - } - throw new \RuntimeException('No resource provided'); - } -diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php -index 63af3cf17709..e752b113e3f1 100644 ---- a/apps/user_ldap/lib/User/Manager.php -+++ b/apps/user_ldap/lib/User/Manager.php -@@ -177,7 +177,7 @@ public function getAttributes($minimal = false) { - $this->access->getConnection()->ldapExtStorageHomeAttribute, - ]; - -- $homeRule = $this->access->getConnection()->homeFolderNamingRule; -+ $homeRule = (string)$this->access->getConnection()->homeFolderNamingRule; - if (strpos($homeRule, 'attr:') === 0) { - $attributes[] = substr($homeRule, strlen('attr:')); - } -diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php -index a0955f94bb4f..ab1500ff3689 100644 ---- a/apps/user_ldap/lib/User/User.php -+++ b/apps/user_ldap/lib/User/User.php -@@ -464,9 +464,9 @@ public function updateEmail($valueFromLDAP = null) { - * bytes), '1234 MB' (quota in MB - check the \OC_Helper::computerFileSize method for more info) - * - * fetches the quota from LDAP and stores it as Nextcloud user value -- * @param string $valueFromLDAP the quota attribute's value can be passed, -+ * @param ?string $valueFromLDAP the quota attribute's value can be passed, - * to save the readAttribute request -- * @return null -+ * @return void - */ - public function updateQuota($valueFromLDAP = null) { - if ($this->wasRefreshed('quota')) { -@@ -487,7 +487,7 @@ public function updateQuota($valueFromLDAP = null) { - } elseif (is_array($aQuota) && isset($aQuota[0])) { - $this->logger->debug('no suitable LDAP quota found for user ' . $this->uid . ': [' . $aQuota[0] . ']', ['app' => 'user_ldap']); - } -- } elseif ($this->verifyQuotaValue($valueFromLDAP)) { -+ } elseif (!is_null($valueFromLDAP) && $this->verifyQuotaValue($valueFromLDAP)) { - $quota = $valueFromLDAP; - } else { - $this->logger->debug('no suitable LDAP quota found for user ' . $this->uid . ': [' . $valueFromLDAP . ']', ['app' => 'user_ldap']); -@@ -509,7 +509,7 @@ public function updateQuota($valueFromLDAP = null) { - } - } - -- private function verifyQuotaValue($quotaValue) { -+ private function verifyQuotaValue(string $quotaValue) { - return $quotaValue === 'none' || $quotaValue === 'default' || \OC_Helper::computerFileSize($quotaValue) !== false; - } - -diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php -index b1d4da9514d6..9cd90451ea37 100644 ---- a/apps/user_ldap/lib/User_LDAP.php -+++ b/apps/user_ldap/lib/User_LDAP.php -@@ -617,7 +617,7 @@ public function getLDAPAccess($uid) { - * The cloned connection needs to be closed manually. - * of the current access. - * @param string $uid -- * @return resource of the LDAP connection -+ * @return resource|\LDAP\Connection The LDAP connection - */ - public function getNewLDAPConnection($uid) { - $connection = clone $this->access->getConnection(); -diff --git a/apps/user_ldap/lib/User_Proxy.php b/apps/user_ldap/lib/User_Proxy.php -index 5731f314aede..183c90493cfa 100644 ---- a/apps/user_ldap/lib/User_Proxy.php -+++ b/apps/user_ldap/lib/User_Proxy.php -@@ -368,7 +368,7 @@ public function getLDAPAccess($uid) { - * The connection needs to be closed manually. - * - * @param string $uid -- * @return resource of the LDAP connection -+ * @return resource|\LDAP\Connection The LDAP connection - */ - public function getNewLDAPConnection($uid) { - return $this->handleRequest($uid, 'getNewLDAPConnection', [$uid]); -diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php -index 9b037b471347..98d399b77b94 100644 ---- a/apps/user_ldap/lib/Wizard.php -+++ b/apps/user_ldap/lib/Wizard.php -@@ -820,7 +820,7 @@ private function detectGroupMemberAssoc() { - return false; - } - $er = $this->ldap->firstEntry($cr, $rr); -- while (is_resource($er)) { -+ while ($this->ldap->isResource($er)) { - $this->ldap->getDN($cr, $er); - $attrs = $this->ldap->getAttributes($cr, $er); - $result = []; -@@ -1066,7 +1066,7 @@ private function connectAndBind($port, $tls) { - ['app' => 'user_ldap'] - ); - $cr = $this->ldap->connect($host, $port); -- if (!is_resource($cr)) { -+ if (!$this->ldap->isResource($cr)) { - throw new \Exception(self::$l->t('Invalid Host')); - } - -@@ -1276,7 +1276,7 @@ private function determineFeature($objectclasses, $attr, $dbkey, $confkey, $po = - - /** - * appends a list of values fr -- * @param resource $result the return value from ldap_get_attributes -+ * @param array $result the return value from ldap_get_attributes - * @param string $attribute the attribute values to look for - * @param array &$known new values will be appended here - * @return int, state on of the class constants LRESULT_PROCESSED_OK, - -From 743267eba4bf0558337dcb47f0f8c382f2b25b69 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chill...@nextcloud.com> -Date: Mon, 29 Nov 2021 11:42:27 +0100 -Subject: [PATCH 07/12] Fix LDAP related docblocks types -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Côme Chilliet <come.chill...@nextcloud.com> ---- - apps/user_ldap/lib/ILDAPWrapper.php | 2 +- - lib/public/LDAP/ILDAPProvider.php | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/apps/user_ldap/lib/ILDAPWrapper.php b/apps/user_ldap/lib/ILDAPWrapper.php -index 9917898a001b..3f600a40cc0e 100644 ---- a/apps/user_ldap/lib/ILDAPWrapper.php -+++ b/apps/user_ldap/lib/ILDAPWrapper.php -@@ -147,7 +147,7 @@ public function nextEntry($link, $result); - /** - * Read an entry - * @param resource|\LDAP\Connection $link LDAP link resource -- * @param array $baseDN The DN of the entry to read from -+ * @param string $baseDN The DN of the entry to read from - * @param string $filter An LDAP filter - * @param array $attr array of the attributes to read - * @return resource|\LDAP\Result an LDAP search result resource -diff --git a/lib/public/LDAP/ILDAPProvider.php b/lib/public/LDAP/ILDAPProvider.php -index 0355a0052c41..8fad3bd2266e 100644 ---- a/lib/public/LDAP/ILDAPProvider.php -+++ b/lib/public/LDAP/ILDAPProvider.php -@@ -79,7 +79,7 @@ public function sanitizeDN($dn); - /** - * Return a new LDAP connection resource for the specified user. - * @param string $uid user id -- * @return resource of the LDAP connection -+ * @return \LDAP\Connection|resource - * @since 11.0.0 - */ - public function getLDAPConnection($uid); -@@ -87,7 +87,7 @@ public function getLDAPConnection($uid); - /** - * Return a new LDAP connection resource for the specified group. - * @param string $gid group id -- * @return resource of the LDAP connection -+ * @return \LDAP\Connection|resource - * @since 13.0.0 - */ - public function getGroupLDAPConnection($gid); - -From 72baee96988bbd9d3f7d68a90bf716008946000f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chill...@nextcloud.com> -Date: Thu, 2 Dec 2021 16:31:19 +0100 -Subject: [PATCH 09/12] Allow minor release of PHP 8.1 to be used as well -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -No reason to allow 8.1.0 and not 8.1.1. - -Signed-off-by: Côme Chilliet <come.chill...@nextcloud.com> ---- - lib/versioncheck.php | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/lib/versioncheck.php b/lib/versioncheck.php -index 8aa68dd35fdd..3e840ff5b461 100644 ---- a/lib/versioncheck.php -+++ b/lib/versioncheck.php -@@ -33,10 +33,10 @@ - exit(1); - } - --// Show warning if > PHP 8.1 is used as Nextcloud is not compatible with > PHP 8.1 for now --if (PHP_VERSION_ID > 80100) { -+// Show warning if >= PHP 8.2 is used as Nextcloud is not compatible with >= PHP 8.2 for now -+if (PHP_VERSION_ID >= 80200) { - http_response_code(500); -- echo 'This version of Nextcloud is not compatible with > PHP 8.1.<br/>'; -+ echo 'This version of Nextcloud is not compatible with PHP>=8.2.<br/>'; - echo 'You are currently running ' . PHP_VERSION . '.'; - exit(1); - } - -From c3a1a66eaefac9e06385d125dd4edae3117cc9eb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chill...@nextcloud.com> -Date: Thu, 16 Dec 2021 10:35:03 +0100 -Subject: [PATCH 12/12] Avoid deprecation warnings about - libxml_disable_entity_loader in PHP 8.1 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Côme Chilliet <come.chill...@nextcloud.com> ---- - lib/private/Updater/ChangesCheck.php | 10 +++++++--- - lib/private/Updater/VersionCheck.php | 10 +++++++--- - 2 files changed, 14 insertions(+), 6 deletions(-) - -diff --git a/lib/private/Updater/ChangesCheck.php b/lib/private/Updater/ChangesCheck.php -index 600c8db9a3c2..e3ced6e5b123 100644 ---- a/lib/private/Updater/ChangesCheck.php -+++ b/lib/private/Updater/ChangesCheck.php -@@ -138,9 +138,13 @@ protected function queryChangesServer(string $uri, ChangesResult $entry): IRespo - protected function extractData($body):array { - $data = []; - if ($body) { -- $loadEntities = libxml_disable_entity_loader(true); -- $xml = @simplexml_load_string($body); -- libxml_disable_entity_loader($loadEntities); -+ if (\LIBXML_VERSION < 20900) { -+ $loadEntities = libxml_disable_entity_loader(true); -+ $xml = @simplexml_load_string($body); -+ libxml_disable_entity_loader($loadEntities); -+ } else { -+ $xml = @simplexml_load_string($body); -+ } - if ($xml !== false) { - $data['changelogURL'] = (string)$xml->changelog['href']; - $data['whatsNew'] = []; -diff --git a/lib/private/Updater/VersionCheck.php b/lib/private/Updater/VersionCheck.php -index ffa707d89909..d9f795796b8c 100644 ---- a/lib/private/Updater/VersionCheck.php -+++ b/lib/private/Updater/VersionCheck.php -@@ -95,9 +95,13 @@ public function check() { - } - - if ($xml) { -- $loadEntities = libxml_disable_entity_loader(true); -- $data = @simplexml_load_string($xml); -- libxml_disable_entity_loader($loadEntities); -+ if (\LIBXML_VERSION < 20900) { -+ $loadEntities = libxml_disable_entity_loader(true); -+ $data = @simplexml_load_string($xml); -+ libxml_disable_entity_loader($loadEntities); -+ } else { -+ $data = @simplexml_load_string($xml); -+ } - if ($data !== false) { - $tmp['version'] = (string)$data->version; - $tmp['versionstring'] = (string)$data->versionstring; Deleted: nextcloud-23.0.0-pimple_php8.1.patch =================================================================== --- nextcloud-23.0.0-pimple_php8.1.patch 2022-04-25 15:28:43 UTC (rev 1190022) +++ nextcloud-23.0.0-pimple_php8.1.patch 2022-04-25 16:05:33 UTC (rev 1190023) @@ -1,130 +0,0 @@ -diff --git a/pimple/pimple/src/Pimple/Container.php b/pimple/pimple/src/Pimple/Container.php -index 715de10e..586a0b77 100644 ---- a/pimple/pimple/src/Pimple/Container.php -+++ b/pimple/pimple/src/Pimple/Container.php -@@ -74,8 +74,11 @@ public function __construct(array $values = []) - * @param string $id The unique identifier for the parameter or object - * @param mixed $value The value of the parameter or a closure to define an object - * -+ * @return void -+ * - * @throws FrozenServiceException Prevent override of a frozen service - */ -+ #[\ReturnTypeWillChange] - public function offsetSet($id, $value) - { - if (isset($this->frozen[$id])) { -@@ -95,6 +98,7 @@ public function offsetSet($id, $value) - * - * @throws UnknownIdentifierException If the identifier is not defined - */ -+ #[\ReturnTypeWillChange] - public function offsetGet($id) - { - if (!isset($this->keys[$id])) { -@@ -130,6 +134,7 @@ public function offsetGet($id) - * - * @return bool - */ -+ #[\ReturnTypeWillChange] - public function offsetExists($id) - { - return isset($this->keys[$id]); -@@ -139,7 +144,10 @@ public function offsetExists($id) - * Unsets a parameter or an object. - * - * @param string $id The unique identifier for the parameter or object -+ * -+ * @return void - */ -+ #[\ReturnTypeWillChange] - public function offsetUnset($id) - { - if (isset($this->keys[$id])) { -@@ -280,8 +288,7 @@ public function keys() - /** - * Registers a service provider. - * -- * @param ServiceProviderInterface $provider A ServiceProviderInterface instance -- * @param array $values An array of values that customizes the provider -+ * @param array $values An array of values that customizes the provider - * - * @return static - */ -diff --git a/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php b/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php -index c173d7c0..714b8826 100644 ---- a/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php -+++ b/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php -@@ -68,7 +68,7 @@ public function get(string $id) - /** - * {@inheritdoc} - */ -- public function has(string $id) -+ public function has(string $id): bool - { - return isset($this->aliases[$id]) && isset($this->container[$this->aliases[$id]]); - } -diff --git a/pimple/pimple/src/Pimple/ServiceIterator.php b/pimple/pimple/src/Pimple/ServiceIterator.php -index 5cde5188..ebafac16 100644 ---- a/pimple/pimple/src/Pimple/ServiceIterator.php -+++ b/pimple/pimple/src/Pimple/ServiceIterator.php -@@ -42,26 +42,46 @@ public function __construct(Container $container, array $ids) - $this->ids = $ids; - } - -+ /** -+ * @return void -+ */ -+ #[\ReturnTypeWillChange] - public function rewind() - { - \reset($this->ids); - } - -+ /** -+ * @return mixed -+ */ -+ #[\ReturnTypeWillChange] - public function current() - { - return $this->container[\current($this->ids)]; - } - -+ /** -+ * @return mixed -+ */ -+ #[\ReturnTypeWillChange] - public function key() - { - return \current($this->ids); - } - -+ /** -+ * @return void -+ */ -+ #[\ReturnTypeWillChange] - public function next() - { - \next($this->ids); - } - -+ /** -+ * @return bool -+ */ -+ #[\ReturnTypeWillChange] - public function valid() - { - return null !== \key($this->ids); -diff --git a/pimple/pimple/src/Pimple/ServiceProviderInterface.php b/pimple/pimple/src/Pimple/ServiceProviderInterface.php -index c004594b..abf90d82 100644 ---- a/pimple/pimple/src/Pimple/ServiceProviderInterface.php -+++ b/pimple/pimple/src/Pimple/ServiceProviderInterface.php -@@ -39,8 +39,6 @@ interface ServiceProviderInterface - * - * This method should only be used to configure services and parameters. - * It should not get services. -- * -- * @param Container $pimple A container instance - */ - public function register(Container $pimple); - } Modified: nextcloud-cron.service =================================================================== --- nextcloud-cron.service 2022-04-25 15:28:43 UTC (rev 1190022) +++ nextcloud-cron.service 2022-04-25 16:05:33 UTC (rev 1190023) @@ -3,7 +3,4 @@ [Service] User=nextcloud -ExecStart=/usr/bin/php -f /usr/share/webapps/nextcloud/cron.php - -[Install] -WantedBy=basic.target +ExecStart=/usr/bin/PHP_INTERPRETER -f /usr/share/webapps/nextcloud/cron.php Modified: nextcloud.hook =================================================================== --- nextcloud.hook 2022-04-25 15:28:43 UTC (rev 1190022) +++ nextcloud.hook 2022-04-25 16:05:33 UTC (rev 1190023) @@ -10,4 +10,4 @@ [Action] Description = Updating Nextcloud installation When = PostTransaction -Exec = /usr/bin/runuser -u nextcloud -- /usr/bin/php /usr/share/webapps/nextcloud/occ upgrade +Exec = /usr/bin/occ upgrade Modified: nextcloud.occ.sh =================================================================== --- nextcloud.occ.sh 2022-04-25 15:28:43 UTC (rev 1190022) +++ nextcloud.occ.sh 2022-04-25 16:05:33 UTC (rev 1190023) @@ -1,7 +1,7 @@ #!/usr/bin/env bash readonly default_config="/etc/php/php.ini" -readonly default_php_command="/usr/bin/php" +readonly default_php_command="/usr/bin/PHP_INTERPRETER" readonly default_user="nextcloud" readonly preserved_environment_vars="NEXTCLOUD_CONFIG_DIR" Modified: nextcloud.uwsgi =================================================================== --- nextcloud.uwsgi 2022-04-25 15:28:43 UTC (rev 1190022) +++ nextcloud.uwsgi 2022-04-25 16:05:33 UTC (rev 1190023) @@ -1,6 +1,6 @@ [uwsgi] procname-master = %n -plugins = php +plugins = PHP_INTERPRETER master = true socket = /run/%n/%n.sock # uncomment for a stats socket, that can be used with uwsgitop @@ -24,7 +24,7 @@ php-docroot = /usr/share/webapps/%n php-index = index.php php-set = date.timezone=Europe/Berlin -php-set = open_basedir=%(cloud_data_dir):%(cloud_writable_apps_dir):/var/lib/%n:/tmp/:/usr/share/webapps/%n:/etc/webapps/%n:/dev/urandom:/usr/lib/php/modules:/run/redis/redis.sock:/var/log/%n/%n.log:/proc/meminfo +php-set = open_basedir=%(cloud_data_dir):%(cloud_writable_apps_dir):/var/lib/%n:/tmp/:/usr/share/webapps/%n:/etc/webapps/%n:/dev/urandom:/usr/lib/PHP_INTERPRETER/modules:/run/redis/redis.sock:/var/log/%n/%n.log:/proc/meminfo php-set = session.save_path=/tmp php-set = session.gc_maxlifetime 21600 php-set = session.gc_divisor 500