From 600c6b43a4136afe5df8a2952bf632617a96d90a Mon Sep 17 00:00:00 2001 From: Git'Fellow <12234510+solracsf@users.noreply.github.com> Date: Sat, 15 Aug 2026 11:22:23 +0200 Subject: [PATCH] fix(sharing): key shares by string when loading share permissions list() builds the $shares array with (string)$row['share_id'], but the permission loading loop looked the same share up with (int)$row['share_id']. share_id is a 64 bit snowflake. On 64 bit PHP a numeric string array key is normalised to an integer key, so the int lookup lands on the same entry and the mismatch is invisible. On 32 bit the value is larger than PHP_INT_MAX, so the key stays a string while the cast saturates to 2147483647 and every lookup misses. The share then comes back with no permissions, ensureDefaults() decides the permission is missing and inserts it a second time, which fails with a unique constraint violation on sharing_share_permissions and leaves the transaction open. That is the whole phpunit-32bits failure: 54 errors and 26 failures in tests/lib/Sharing alone, cascading into 180 errors and 81 failures across the suite once the leftover test users start colliding. Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> --- lib/private/Sharing/SharingBackend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Sharing/SharingBackend.php b/lib/private/Sharing/SharingBackend.php index e8cd285e50389..f0331cb6fb7be 100644 --- a/lib/private/Sharing/SharingBackend.php +++ b/lib/private/Sharing/SharingBackend.php @@ -991,7 +991,7 @@ private function list( $result = $qb->executeQuery(); foreach ($result->fetchAll() as $row) { - $id = (int)$row['share_id']; + $id = (string)$row['share_id']; /** @var class-string $permissionTypeClass */ $permissionTypeClass = $this->classMapper->getClassName((int)$row['permission_class_id']);