From ddcfd6c4b03b47ab1143a24fa7f73d162d41b65d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20Villaf=C3=A1=C3=B1ez?= Date: Fri, 20 Mar 2026 14:50:47 +0100 Subject: [PATCH] fix: the substr function will return an empty string instead of false --- lib/private/Share/Share.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index 10500ba4947..49343dc0b56 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -179,6 +179,8 @@ public static function getUsersSharingFile($path, $ownerUser, $includeOwner = fa $mountPath = $meta->getMountPoint()->getMountPoint(); if ($mountPath !== false) { $mountPath = \substr($mountPath, \strlen('/' . $ownerUser . '/files')); + // Note: if the mountPath is shorter than the strlen, substr in php 7.4 returns false + // but in php 8+ returns an empty string } } @@ -312,7 +314,7 @@ public static function getUsersSharingFile($path, $ownerUser, $includeOwner = fa $result = $query->executeQuery(); while ($row = $result->fetchAssociative()) { foreach ($fileTargets[$row['fileid']] as $uid => $shareData) { - if ($mountPath !== false) { + if ($mountPath !== false && $mountPath !== '') { $sharedPath = $shareData['file_target']; $sharedPath .= \substr($path, \strlen($mountPath) + \strlen($paths[$row['fileid']])); $sharePaths[$uid] = $sharedPath;