Skip to content

fix: Fix getting trusted server other than the first - #54371

Merged
st3iny merged 1 commit into
masterfrom
fix-getting-trusted-server-other-than-the-first
Aug 12, 2025
Merged

fix: Fix getting trusted server other than the first#54371
st3iny merged 1 commit into
masterfrom
fix-getting-trusted-server-other-than-the-first

Conversation

@danxuliu

@danxuliudanxuliu commented Aug 12, 2025

Copy link
Copy Markdown
Member

Fixes a regression introduced in #49973 (specifically, in 669e6ca)

array_filter preserves the keys, so after the trusted servers were filtered $server[0] existed only if the server to get was the first one in the original array.

How to test

  • Open the Sharing section in Nextcloud administration settings
  • Add two trusted servers
  • Remove the last one added

Result with this pull request

No errors are logged

Result without this pull request

An error with message Undefined array key 0 at... is logged

"array_filter" preserves the keys, so after the trusted servers were
filtered "$server[0]" existed only if the server to get was the first
one in the original array.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@danxuliu

Copy link
Copy Markdown
MemberAuthor

/backport to stable31

@danxuliudanxuliu added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Aug 12, 2025
@danxuliu
danxuliu marked this pull request as ready for review August 12, 2025 05:36
@danxuliu
danxuliu requested a review from a team as a code ownerAugust 12, 2025 05:36
@danxuliu
danxuliu requested review from ArtificialOwl, CarlSchwan and leftybournes and removed request for a teamAugust 12, 2025 05:36
@kesselb
kesselb requested review from hamza221 and st3inyAugust 12, 2025 10:31

@st3inyst3iny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, I love arcane PHP behavior ...

@st3iny
st3iny merged commit b4302fe into masterAug 12, 2025
210 of 212 checks passed
@st3iny
st3iny deleted the fix-getting-trusted-server-other-than-the-first branch August 12, 2025 11:25
@skjnldsvskjnldsv mentioned this pull request Aug 19, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@danxuliu@st3iny@kesselb@skjnldsv