From 79178ba12385f59fef29776d8161bce05ab8666d Mon Sep 17 00:00:00 2001 From: nextcloud-command Date: Fri, 20 Nov 2026 19:01:51 +0000 Subject: [PATCH 1/7] test(lint): Lint code base against PHP 8.6 Signed-off-by: nextcloud-command --- 3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty b/3rdparty index 23eb2c6a9a518..a73c855a80055 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit 23eb2c6a9a518e02e9c17a8b89b59b3e934fa743 +Subproject commit a73c855a80055c37bc6fab6c34c88e8e9ec61b74 From 0104bbbdbf8673dae6cbd466f66ab6f36fc64fbf Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 20 Nov 2026 20:02:08 +0100 Subject: [PATCH 2/7] fix(PHP): Allow installing with 8.6 Signed-off-by: Joas Schilling --- lib/versioncheck.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/versioncheck.php b/lib/versioncheck.php index cfc1dda5bbe09..44fc8d3c598ea 100644 --- a/lib/versioncheck.php +++ b/lib/versioncheck.php @@ -13,10 +13,10 @@ exit(1); } -// Show warning if >= PHP 8.6 is used as Nextcloud is not compatible with >= PHP 8.6 for now -if (PHP_VERSION_ID >= 80600) { +// Show warning if >= PHP 8.7 is used as Nextcloud is not compatible with >= PHP 8.7 for now +if (PHP_VERSION_ID >= 80700) { http_response_code(500); - echo 'This version of Nextcloud is not compatible with PHP>=8.6.
'; + echo 'This version of Nextcloud is not compatible with PHP>=8.7.
'; echo 'You are currently running ' . PHP_VERSION . '.'; exit(1); } From 191ecf2f2cd10e0075d3c4d77e611d91dcce030d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 20 Nov 2026 20:02:24 +0100 Subject: [PATCH 3/7] ci(PHP): Test against 8.6 Signed-off-by: Joas Schilling --- .github/ISSUE_TEMPLATE/BUG_REPORT.yml | 1 + .github/workflows/files-external.yml | 2 +- .github/workflows/integration-dav.yml | 2 +- .github/workflows/integration-litmus.yml | 2 +- .github/workflows/integration-s3-primary.yml | 2 +- .github/workflows/integration-sqlite.yml | 2 +- .github/workflows/lint-php.yml | 2 +- .github/workflows/object-storage.yml | 2 +- .github/workflows/phpunit-kvstore.yml | 2 +- .github/workflows/phpunit-mariadb.yml | 2 +- .github/workflows/phpunit-memcached.yml | 2 +- .github/workflows/phpunit-mysql-sharding.yml | 2 +- .github/workflows/phpunit-mysql.yml | 2 +- .github/workflows/phpunit-nodb.yml | 2 +- .github/workflows/phpunit-object-store-primary.yml | 2 +- .github/workflows/phpunit-oci.yml | 2 +- .github/workflows/phpunit-pgsql.yml | 2 +- .github/workflows/phpunit-sqlite.yml | 2 +- 18 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index 12351f1d642b9..143d4085d0a7c 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -98,6 +98,7 @@ body: Select PHP engine version serving Nextcloud Server. _Describe in the "Additional info" section if you chose "Other"._ options: + - "PHP 8.6" - "PHP 8.5" - "PHP 8.4" - "PHP 8.3" diff --git a/.github/workflows/files-external.yml b/.github/workflows/files-external.yml index 7cd2527f8bf43..242e8e289004b 100644 --- a/.github/workflows/files-external.yml +++ b/.github/workflows/files-external.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.3', '8.5'] + php-versions: ['8.3', '8.6'] backend: ['generic', 'proftpd', 'vsftpd', 'pure-ftpd', 's3-minio', 's3-localstack', 'openssh', 'smb', 'webdav'] name: php${{ matrix.php-versions }}-${{ matrix.backend }} diff --git a/.github/workflows/integration-dav.yml b/.github/workflows/integration-dav.yml index 7187602367d70..bca24c1d546d7 100644 --- a/.github/workflows/integration-dav.yml +++ b/.github/workflows/integration-dav.yml @@ -45,7 +45,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.3', '8.5'] + php-versions: ['8.3', '8.6'] endpoint: ['old', 'new'] service: ['CalDAV', 'CardDAV'] diff --git a/.github/workflows/integration-litmus.yml b/.github/workflows/integration-litmus.yml index 23f43b314e82c..3f1deebaeaa92 100644 --- a/.github/workflows/integration-litmus.yml +++ b/.github/workflows/integration-litmus.yml @@ -45,7 +45,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.3', '8.5'] + php-versions: ['8.3', '8.6'] endpoint: ['webdav', 'dav'] name: Litmus WebDAV ${{ matrix.endpoint }} diff --git a/.github/workflows/integration-s3-primary.yml b/.github/workflows/integration-s3-primary.yml index be896bbe25b25..a3a30149b32be 100644 --- a/.github/workflows/integration-s3-primary.yml +++ b/.github/workflows/integration-s3-primary.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.3', '8.5'] + php-versions: ['8.3', '8.6'] key: ['objectstore', 'objectstore_multibucket'] name: php${{ matrix.php-versions }}-${{ matrix.key }}-minio diff --git a/.github/workflows/integration-sqlite.yml b/.github/workflows/integration-sqlite.yml index f742bfc5beefe..8d55934d9a316 100644 --- a/.github/workflows/integration-sqlite.yml +++ b/.github/workflows/integration-sqlite.yml @@ -70,7 +70,7 @@ jobs: - 'videoverification_features' - 'guests_features' - php-versions: ['8.3', '8.5'] + php-versions: ['8.3', '8.6'] guests-versions: ['main'] spreed-versions: ['main'] activity-versions: ['main'] diff --git a/.github/workflows/lint-php.yml b/.github/workflows/lint-php.yml index f406f3185440d..497a64ab85373 100644 --- a/.github/workflows/lint-php.yml +++ b/.github/workflows/lint-php.yml @@ -47,7 +47,7 @@ jobs: strategy: matrix: - php-versions: ['8.3', '8.5'] + php-versions: ['8.3', '8.6'] name: php-lint diff --git a/.github/workflows/object-storage.yml b/.github/workflows/object-storage.yml index fd4d510155ceb..a5a729e54bd59 100644 --- a/.github/workflows/object-storage.yml +++ b/.github/workflows/object-storage.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.3', '8.5'] + php-versions: ['8.3', '8.6'] backend: ['s3', 'azure', 'swift'] name: php${{ matrix.php-versions }}-${{ matrix.backend }} diff --git a/.github/workflows/phpunit-kvstore.yml b/.github/workflows/phpunit-kvstore.yml index b41780c79ae14..b51daca598a61 100644 --- a/.github/workflows/phpunit-kvstore.yml +++ b/.github/workflows/phpunit-kvstore.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ["8.3", "8.5"] + php-versions: ["8.3", "8.6"] # The three supported topologies for the key-value store cache topology: ["single", "cluster", "sentinel"] diff --git a/.github/workflows/phpunit-mariadb.yml b/.github/workflows/phpunit-mariadb.yml index 506d620c1b770..71da739c4b926 100644 --- a/.github/workflows/phpunit-mariadb.yml +++ b/.github/workflows/phpunit-mariadb.yml @@ -25,7 +25,7 @@ jobs: - mariadb-versions: '10.11' php-versions: '8.3' - mariadb-versions: '12.3' - php-versions: '8.5' + php-versions: '8.6' name: MariaDB ${{ matrix.mariadb-versions }} (PHP ${{ matrix.php-versions }}) - database tests diff --git a/.github/workflows/phpunit-memcached.yml b/.github/workflows/phpunit-memcached.yml index 96dc657e6cb41..7237d99a5141e 100644 --- a/.github/workflows/phpunit-memcached.yml +++ b/.github/workflows/phpunit-memcached.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ["8.3", "8.5"] + php-versions: ["8.3", "8.6"] name: Memcached (PHP ${{ matrix.php-versions }}) diff --git a/.github/workflows/phpunit-mysql-sharding.yml b/.github/workflows/phpunit-mysql-sharding.yml index 191f3969b4c6b..68961805ccf0b 100644 --- a/.github/workflows/phpunit-mysql-sharding.yml +++ b/.github/workflows/phpunit-mysql-sharding.yml @@ -25,7 +25,7 @@ jobs: - mysql-versions: '8.4' php-versions: '8.3' - mysql-versions: '9.7' - php-versions: '8.5' + php-versions: '8.6' name: Sharding - MySQL ${{ matrix.mysql-versions }} (PHP ${{ matrix.php-versions }}) - database tests diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml index b70971711b670..c9d07463fd893 100644 --- a/.github/workflows/phpunit-mysql.yml +++ b/.github/workflows/phpunit-mysql.yml @@ -26,7 +26,7 @@ jobs: php-versions: '8.3' partitioning: false - mysql-versions: '9.7' - php-versions: '8.5' + php-versions: '8.6' partitioning: true name: MySQL ${{ matrix.mysql-versions }} (PHP ${{ matrix.php-versions }})${{ case(matrix.partitioning, ' Partitioning', '') }} - database tests diff --git a/.github/workflows/phpunit-nodb.yml b/.github/workflows/phpunit-nodb.yml index 488bdb5de339e..7dce5bc276c00 100644 --- a/.github/workflows/phpunit-nodb.yml +++ b/.github/workflows/phpunit-nodb.yml @@ -23,7 +23,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.3', '8.5'] + php-versions: ['8.3', '8.6'] name: No DB unit tests (PHP ${{ matrix.php-versions }}) diff --git a/.github/workflows/phpunit-object-store-primary.yml b/.github/workflows/phpunit-object-store-primary.yml index f72baa62f007f..99c7fd341764a 100644 --- a/.github/workflows/phpunit-object-store-primary.yml +++ b/.github/workflows/phpunit-object-store-primary.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.3', '8.5'] + php-versions: ['8.3', '8.6'] key: ['s3', 's3-multibucket'] name: php${{ matrix.php-versions }}-${{ matrix.key }}-minio diff --git a/.github/workflows/phpunit-oci.yml b/.github/workflows/phpunit-oci.yml index b5850ad803cd4..969dce5ee2f02 100644 --- a/.github/workflows/phpunit-oci.yml +++ b/.github/workflows/phpunit-oci.yml @@ -27,7 +27,7 @@ jobs: - oracle-versions: '18' php-versions: '8.3' - oracle-versions: '23' - php-versions: '8.5' + php-versions: '8.6' name: Oracle ${{ matrix.oracle-versions }} (PHP ${{ matrix.php-versions }}) - database tests diff --git a/.github/workflows/phpunit-pgsql.yml b/.github/workflows/phpunit-pgsql.yml index 864f197f6ec7b..82e7702422c9b 100644 --- a/.github/workflows/phpunit-pgsql.yml +++ b/.github/workflows/phpunit-pgsql.yml @@ -25,7 +25,7 @@ jobs: - postgres-versions: '14' php-versions: '8.3' - postgres-versions: '18' - php-versions: '8.5' + php-versions: '8.6' name: PostgreSQL ${{ matrix.postgres-versions }} (PHP ${{ matrix.php-versions }}) - database tests diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml index 149be3f2f7545..14b3a6c2d4c7f 100644 --- a/.github/workflows/phpunit-sqlite.yml +++ b/.github/workflows/phpunit-sqlite.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.3', '8.5'] + php-versions: ['8.3', '8.6'] name: SQLite (PHP ${{ matrix.php-versions }}) From 196705845a96dbf050e32bd061d8ce29d29c47b8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 20 Nov 2026 20:02:44 +0100 Subject: [PATCH 4/7] fix(PHP): Remove code for PHP 8.2 and lower Signed-off-by: Joas Schilling --- lib/private/legacy/OC_Util.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 580f244447d33..f48c7f07b69ca 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -507,12 +507,7 @@ public static function isSetLocaleWorking(): bool { * @internal */ private static function isAnnotationsWorking(): bool { - if (PHP_VERSION_ID >= 80300) { - /** @psalm-suppress UndefinedMethod */ - $reflection = \ReflectionMethod::createFromMethodName(__METHOD__); - } else { - $reflection = new \ReflectionMethod(__METHOD__); - } + $reflection = \ReflectionMethod::createFromMethodName(__METHOD__); $docs = $reflection->getDocComment(); return (is_string($docs) && strlen($docs) > 50); From c2af5dbb5f90633bfa111eacf445090a19ccc701 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 21 Nov 2026 18:40:11 +0100 Subject: [PATCH 5/7] build: Update 3rdparty guzzlehttp/promises Signed-off-by: Joas Schilling --- 3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty b/3rdparty index a73c855a80055..f2a011d49aaad 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit a73c855a80055c37bc6fab6c34c88e8e9ec61b74 +Subproject commit f2a011d49aaad7295781b16e39744a3f01840db5 From 3943a1a01002b67814a58ae41ea2cf866fe720f9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 21 Nov 2026 19:16:33 +0100 Subject: [PATCH 6/7] fix(session): Fix session strict mode which is default enabled with PHP 8.6 Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Joas Schilling --- lib/private/Session/Internal.php | 20 +++++++++++++++++--- tests/lib/Session/InternalTest.php | 8 ++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/private/Session/Internal.php b/lib/private/Session/Internal.php index 96d099bda4e00..4826c15e1d3e1 100644 --- a/lib/private/Session/Internal.php +++ b/lib/private/Session/Internal.php @@ -46,6 +46,11 @@ class Internal extends Session { */ private bool $cookieAllowed = true; + /** + * The session.use_strict_mode value to restore before the next session start + */ + private ?string $strictModeToRestore = null; + /** * @param string $name * @throws \Exception @@ -235,12 +240,21 @@ function () use ($silence, $functionName, $parameters) { /** * @param bool $sendCookie Whether PHP may send the session cookie, which can replace a newer id the browser holds + * @param bool $strictMode Whether session.use_strict_mode may replace an id that does not exist in the storage */ - private function startSession(bool $readAndClose = true, bool $sendCookie = true) { + private function startSession(bool $readAndClose = true, bool $sendCookie = true, bool $strictMode = true) { $sessionParams = [ 'cookie_samesite' => 'Lax', 'use_cookies' => $sendCookie, ]; + // session_start() options stay set for the rest of the request + if (!$strictMode) { + $this->strictModeToRestore ??= (string)ini_get('session.use_strict_mode'); + $sessionParams['use_strict_mode'] = false; + } elseif ($this->strictModeToRestore !== null) { + $sessionParams['use_strict_mode'] = $this->strictModeToRestore; + $this->strictModeToRestore = null; + } if (\OC::hasSessionRelaxedExpiry()) { $sessionParams['read_and_close'] = $readAndClose; } @@ -278,9 +292,9 @@ private function switchToNewId(string $oldId, bool $deleteOldSession): bool { $regenerated = $this->invoke('session_regenerate_id', [$deleteOldSession && !$markOldId], true) === true; if (!$regenerated && $oldId !== '' && !$this->isActive()) { - // Continue on the old id + // Continue on the old id, strict mode would reject it when session_regenerate_id() already deleted it $this->invoke('session_id', [$oldId], true); - $this->startSession(readAndClose: false, sendCookie: false); + $this->startSession(readAndClose: false, sendCookie: false, strictMode: false); } $_SESSION = $data; $this->sessionClosed = !$this->isActive(); diff --git a/tests/lib/Session/InternalTest.php b/tests/lib/Session/InternalTest.php index 4145563dceeee..e4c3b44640ae6 100644 --- a/tests/lib/Session/InternalTest.php +++ b/tests/lib/Session/InternalTest.php @@ -358,6 +358,11 @@ public function testFailedRegenerationSkipsTokenRenewal(): void { public function create_sid(): string { return $this->failNewIds ? '' : parent::create_sid(); } + + // SessionHandler implements this since PHP 8.6 + public function validateId(string $id): bool { + return is_file(session_save_path() . '/sess_' . $id); + } }; session_set_save_handler($handler, false); $session = $this->startRequest(); @@ -380,6 +385,9 @@ public function create_sid(): string { $this->assertSame($oldId, $session->getId()); $this->assertSame(['foo' => 'bar', 'after' => 'failed regeneration'], $this->readStoredSession($oldId)); + + $session->reopen(); + $this->assertSame('1', ini_get('session.use_strict_mode')); } public function testFailedSwitchToFreshSessionKeepsLaterWrites(): void { From 66e77a81e05c2df5573702a362646bcbcf9daeea Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 21 Nov 2026 19:22:23 +0100 Subject: [PATCH 7/7] test(integration): Fix accepted request size in integration tests with PHP 8.6 Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Joas Schilling --- .github/workflows/integration-litmus.yml | 2 +- build/integration/run.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-litmus.yml b/.github/workflows/integration-litmus.yml index 3f1deebaeaa92..d851d788d3441 100644 --- a/.github/workflows/integration-litmus.yml +++ b/.github/workflows/integration-litmus.yml @@ -84,7 +84,7 @@ jobs: - name: Run Nextcloud run: | - php -S 0.0.0.0:8080 & + php -d post_max_size=0 -S 0.0.0.0:8080 & - name: Run Litmus test run: | diff --git a/build/integration/run.sh b/build/integration/run.sh index 4ff808b5056b9..3c07a1d3b8a20 100755 --- a/build/integration/run.sh +++ b/build/integration/run.sh @@ -55,7 +55,7 @@ export PORT echo "" > "${NC_DATADIR}/nextcloud.log" echo "" > phpserver.log -PHP_CLI_SERVER_WORKERS=2 php -S localhost:$PORT -t ../.. &> phpserver.log & +PHP_CLI_SERVER_WORKERS=2 php -d post_max_size=0 -S localhost:$PORT -t ../.. &> phpserver.log & PHPPID=$! echo $PHPPID