From cf53842e8a53907a8072ea1e5c42ddc289196215 Mon Sep 17 00:00:00 2001 From: Phillip Davis Date: Fri, 17 Jul 2026 18:30:00 +0930 Subject: [PATCH 1/2] test: report and fix deprecations emitted by PHP unit tests Set convertDeprecationsToExceptions to true in PHP unit tests, so that we know if any code is executed that is deprecated in the running PHP version. Signed-off-by: Phillip Davis --- tests/lib/SetupTest.php | 20 ++++++++++++++++++++ tests/phpunit-autotest.xml | 1 + 2 files changed, 21 insertions(+) diff --git a/tests/lib/SetupTest.php b/tests/lib/SetupTest.php index 1cad282a228c..77625549bd5d 100644 --- a/tests/lib/SetupTest.php +++ b/tests/lib/SetupTest.php @@ -145,6 +145,13 @@ public function testCannotUpdateHtaccess(): void { \touch($htaccessFile); \chmod($htaccessFile, 0400); \OC::$SERVERROOT = \OC::$SERVERROOT . '/tests/data'; + $this->config + ->expects($this->exactly(2)) + ->method('getSystemValue') + ->willReturnOnConsecutiveCalls( + 'https://www.example.com/owncloud', + '/' + ); try { $this->setupClass->updateHtaccess($this->config); } catch (\Exception $e) { @@ -167,6 +174,12 @@ public function testHtaccessIsFolder(): void { @\mkdir($htaccessFile); \OC::$SERVERROOT = \OC::$SERVERROOT . '/tests/data'; + $this->config + ->expects($this->exactly(1)) + ->method('getSystemValue') + ->willReturnOnConsecutiveCalls( + 'https://www.example.com/owncloud' + ); try { $this->setupClass->updateHtaccess($this->config); } catch (\Exception $e) { @@ -183,6 +196,13 @@ public function testUpdateHtaccess(): void { \touch($htaccessFile); \chmod($htaccessFile, 0700); \OC::$SERVERROOT = \OC::$SERVERROOT . '/tests/data'; + $this->config + ->expects($this->exactly(2)) + ->method('getSystemValue') + ->willReturnOnConsecutiveCalls( + 'https://www.example.com/owncloud', + '/' + ); try { $this->setupClass->updateHtaccess($this->config); } catch (\Exception $e) { diff --git a/tests/phpunit-autotest.xml b/tests/phpunit-autotest.xml index 040a265a3d94..34a32e13428e 100644 --- a/tests/phpunit-autotest.xml +++ b/tests/phpunit-autotest.xml @@ -4,6 +4,7 @@ failOnWarning="true" timeoutForSmallTests="900" timeoutForMediumTests="900" timeoutForLargeTests="900" + convertDeprecationsToExceptions="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"> From 9176d34a34130b173b2227b6681f9da52d39b47d Mon Sep 17 00:00:00 2001 From: Phillip Davis Date: Fri, 17 Jul 2026 19:03:53 +0930 Subject: [PATCH 2/2] fix: avoid deprecation in call to trim in PostgreSQLMigrator The code trims brackets from the default value of a column. This is only relevant if the default value is a string. Avoid using trim in cases where the default is not a string, for example, when the default colun value is null. Signed-off-by: Phillip Davis --- lib/private/DB/PostgreSqlMigrator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/private/DB/PostgreSqlMigrator.php b/lib/private/DB/PostgreSqlMigrator.php index 415b2c1ed769..e2e2983c07c2 100644 --- a/lib/private/DB/PostgreSqlMigrator.php +++ b/lib/private/DB/PostgreSqlMigrator.php @@ -42,7 +42,9 @@ protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $conn } $fromDefault = $column->fromColumn->getDefault(); $toDefault = $column->column->getDefault(); - $fromDefault = \trim($fromDefault, "()"); + if (\is_string($fromDefault)) { + $fromDefault = \trim($fromDefault, "()"); + } // by intention usage of != return $fromDefault != $toDefault;