Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/files-external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-dav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-litmus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-s3-primary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:

strategy:
matrix:
php-versions: ['8.3', '8.5']
php-versions: ['8.3', '8.6']

name: php-lint

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/object-storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit-kvstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit-mariadb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit-memcached.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }})

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit-mysql-sharding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit-nodb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }})

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit-object-store-primary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit-oci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit-pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit-sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }})

Expand Down
2 changes: 1 addition & 1 deletion build/integration/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 17 additions & 3 deletions lib/private/Session/Internal.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down
7 changes: 1 addition & 6 deletions lib/private/legacy/OC_Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions lib/versioncheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br/>';
echo 'This version of Nextcloud is not compatible with PHP>=8.7.<br/>';
echo 'You are currently running ' . PHP_VERSION . '.';
exit(1);
}
8 changes: 8 additions & 0 deletions tests/lib/Session/InternalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 {
Expand Down
Loading