From c09b0de3ad556d35af339092fdf5027536c18e67 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Mon, 28 Sep 2026 14:08:09 +0200 Subject: [PATCH 1/2] fix(Sharing): Fix recipient IDs on 32-bits Signed-off-by: provokateurin --- lib/private/Sharing/SharingBackend.php | 12 ++++++------ lib/private/Sharing/SharingManager.php | 2 +- tests/lib/Sharing/SharingManagerTest.php | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/private/Sharing/SharingBackend.php b/lib/private/Sharing/SharingBackend.php index ebfca5a7bd198..1811f6fdeac3f 100644 --- a/lib/private/Sharing/SharingBackend.php +++ b/lib/private/Sharing/SharingBackend.php @@ -474,7 +474,7 @@ public function updateShareRecipientPermission(string $id, ShareRecipient $recip ->andWhere($this->isNullOrEqual($qb, 'recipient_instance', $recipient->instance)) ->executeQuery(); - /** @var int|false $recipientId */ + /** @var int|string|false $recipientId */ $recipientId = $result->fetchOne(); if ($recipientId === false) { throw new ShareNotFoundException(); @@ -484,7 +484,7 @@ public function updateShareRecipientPermission(string $id, ShareRecipient $recip $rowCount = $qb ->update('sharing_share_recipient_permissions') ->set('permission_enabled', $qb->createNamedParameter($permission->enabled, IQueryBuilder::PARAM_BOOL)) - ->where($qb->expr()->eq('recipient_id', $qb->createNamedParameter($recipientId))) + ->where($qb->expr()->eq('recipient_id', $qb->createNamedParameter((string)$recipientId, IQueryBuilder::PARAM_STR))) ->andWhere( $qb->expr()->eq('permission_class_id', $qb->createNamedParameter($this->classMapper->getClassId($permission->class), IQueryBuilder::PARAM_INT)) ) @@ -494,7 +494,7 @@ public function updateShareRecipientPermission(string $id, ShareRecipient $recip $qb ->insert('sharing_share_recipient_permissions') ->values([ - 'recipient_id' => $qb->createNamedParameter($recipientId), + 'recipient_id' => $qb->createNamedParameter((string)$recipientId, IQueryBuilder::PARAM_STR), 'permission_class_id' => $qb->createNamedParameter($this->classMapper->getClassId($permission->class), IQueryBuilder::PARAM_INT), 'permission_enabled' => $qb->createNamedParameter($permission->enabled, IQueryBuilder::PARAM_BOOL), ]) @@ -1012,7 +1012,7 @@ private function list( ) ->from('sharing_share_recipient_permissions', 'srp') ->innerJoin('srp', 'sharing_share_recipients', 'sr', $qb->expr()->eq('sr.id', 'srp.recipient_id')) - ->where($qb->expr()->in('srp.recipient_id', $qb->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY))) + ->where($qb->expr()->in('srp.recipient_id', $qb->createNamedParameter($chunk, IQueryBuilder::PARAM_STR_ARRAY))) ->executeQuery(); foreach ($result->fetchAll() as $row) { @@ -1026,8 +1026,8 @@ private function list( continue; } - /** @var int $recipientId */ - $recipientId = $row['recipient_id']; + /** @var non-empty-string $recipientId */ + $recipientId = (string)$row['recipient_id']; $shareRecipientPermissions[$shareId] ??= []; $shareRecipientPermissions[$shareId][$recipientId] ??= []; diff --git a/lib/private/Sharing/SharingManager.php b/lib/private/Sharing/SharingManager.php index 328b919ec110f..4b035e55741f2 100644 --- a/lib/private/Sharing/SharingManager.php +++ b/lib/private/Sharing/SharingManager.php @@ -682,7 +682,7 @@ public function updateShareRecipientPermission(ShareAccessContext $accessContext $recipients = $share->recipients; foreach ($recipients as &$shareRecipient) { - if ($shareRecipient->class === $recipient->class && $shareRecipient->value === $recipient->value && $shareRecipient->instance === $recipient->instance) { + if ($shareRecipient->equals($recipient)) { $permissions = $shareRecipient->permissions; $permissions[$permission->class] = $permission; diff --git a/tests/lib/Sharing/SharingManagerTest.php b/tests/lib/Sharing/SharingManagerTest.php index b25a4f7610909..2cdfeb6ec3102 100644 --- a/tests/lib/Sharing/SharingManagerTest.php +++ b/tests/lib/Sharing/SharingManagerTest.php @@ -54,11 +54,11 @@ private function assertShareSyncedWithDb(ShareAccessContext $accessContext, Shar foreach ($item->recipients as $recipient) { $recipient->getDisabledPermissions(); } - } - // ensure source metadata is loaded - foreach ($share->sources as $source) { - $source->format($this->registry, $this->l10nFactory, false); + // ensure source metadata is loaded + foreach ($item->sources as $source) { + $source->format($this->registry, $this->l10nFactory, false); + } } $this->assertEquals($retrieved, $share, 'share object not in sync with database'); From fe22f6431bae48a271db5923750eb6b171550ec5 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Mon, 28 Sep 2026 14:08:33 +0200 Subject: [PATCH 2/2] ci: Run 32-bits CI for Unified Sharing changes Signed-off-by: provokateurin --- .github/workflows/phpunit-32bits.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/phpunit-32bits.yml b/.github/workflows/phpunit-32bits.yml index f1d8da06fd0e2..fed2e8ad01951 100644 --- a/.github/workflows/phpunit-32bits.yml +++ b/.github/workflows/phpunit-32bits.yml @@ -10,6 +10,8 @@ on: - "tests/phpunit-autotest.xml" - "lib/private/Snowflake/*" - "tests/lib/Preview/PreviewMapperTest.php" + - "lib/private/Sharing" + - "tests/lib/Sharing" workflow_dispatch: schedule: - cron: "15 1 * * 1-6"