diff --git a/apps/comments/lib/Dav/CommentNode.php b/apps/comments/lib/Dav/CommentNode.php index f90e47153bfa..6dab831d4e72 100644 --- a/apps/comments/lib/Dav/CommentNode.php +++ b/apps/comments/lib/Dav/CommentNode.php @@ -228,8 +228,8 @@ public function getProperties($properties) { $result = []; foreach ($properties as $property) { - $getter = $this->properties[$property]; - if (\method_exists($this->comment, $getter)) { + $getter = $this->properties[$property] ?? null; + if (($getter !== null) && \method_exists($this->comment, $getter)) { $result[$property] = $this->comment->$getter(); } } diff --git a/apps/comments/lib/Dav/EntityCollection.php b/apps/comments/lib/Dav/EntityCollection.php index a60a6001b342..c30d08fbf592 100644 --- a/apps/comments/lib/Dav/EntityCollection.php +++ b/apps/comments/lib/Dav/EntityCollection.php @@ -171,7 +171,7 @@ public function childExists($name) { * @return bool */ public function setReadMarker($value) { - $dateTime = new \DateTime($value); + $dateTime = new \DateTime($value ?? 'now'); $user = $this->userSession->getUser(); $this->commentsManager->setReadMark($this->name, $this->id, $dateTime, $user); return true; diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php index c4e5315a00df..f40e8b988035 100644 --- a/apps/dav/lib/Server.php +++ b/apps/dav/lib/Server.php @@ -240,7 +240,7 @@ public function __construct(IRequest $request, $baseUri) { $this->server->addPlugin(new PreviewPlugin(OC::$server->getTimeFactory(), OC::$server->getPreviewManager())); $this->server->on('beforeMethod:PROPFIND', function (Request $request) use ($config) { - $depthHeader = strtolower($request->getHeader('depth')); + $depthHeader = strtolower((string) $request->getHeader('depth')); if ($depthHeader === 'infinity' && !$config->getSystemValue('dav.propfind.depth_infinity', false)) { throw new Exception\PreconditionFailed('Depth infinity not supported'); diff --git a/changelog/unreleased/41656 b/changelog/unreleased/41656 new file mode 100644 index 000000000000..9ada2e4a4c0b --- /dev/null +++ b/changelog/unreleased/41656 @@ -0,0 +1,5 @@ +Bugfix: handle deprecated code related to comments app + +Code paths that caused deprecation warnings in PHP 8 have been corrected. + +https://github.com/owncloud/core/pull/41656