fix(sharing): key shares by string when loading share permissions - #63291
Open
solracsf wants to merge 1 commit into
Open
fix(sharing): key shares by string when loading share permissions#63291solracsf wants to merge 1 commit into
solracsf wants to merge 1 commit into
Conversation
solracsf
requested review from
Altahrim,
CarlSchwan and
leftybournes
and removed request for
a team
August 15, 2026 09:25
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>
solracsf
force-pushed
the
fix/sharing-backend-32bit-share-id
branch
from
August 15, 2026 10:04
1e63119 to
600c6b4
Compare
solracsf
enabled auto-merge
August 15, 2026 10:37
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 32bits CI failures: https://github.com/nextcloud/server/actions/runs/31869049089/job/94981641073
list()builds the$sharesarray 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.Checklist
3. to review, feature component)stable32)AI (if applicable)