Skip to content

fix(NavigationManager): do not warn when an unknown entry is requested - #62361

Open
solracsf wants to merge 1 commit into
nextcloud:masterfrom
solracsf:fix/navigation-manager-unknown-entry
Open

fix(NavigationManager): do not warn when an unknown entry is requested#62361
solracsf wants to merge 1 commit into
nextcloud:masterfrom
solracsf:fix/navigation-manager-unknown-entry

Conversation

@solracsf

@solracsf solracsf commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

NavigationManager::get() is declared ?array and all of its callers handle null: TemplateLayout even branches on $currentAppData === null for RENDER_AS_PUBLIC. The lookup itself does not guard against a missing key.

So every public page rendered by an app that registers no navigation entry (typical for files-integration apps) logs one PHP warning per anonymous page view:

Undefined array key "drawio" at /var/www/nextcloud/lib/private/NavigationManager.php#432

Reproduction on 33.0.6: share a file handled by such an app (e.g. drawio) as a public link, open the link in a private window. The page renders fine (the layout receives null and shows an empty app list), only the log noise is the problem.

A unit test locks the contract (get('unknown') returns null); before the fix it surfaces the Undefined array key warning.

Checklist

AI (if applicable)

  • The test of this PR was partly or fully generated using AI

get() is declared to return ?array and all of its callers handle null -
the public page layout explicitly renders an empty app list when the
current app has no navigation entry. The lookup itself did not guard
against a missing key though, so every public page rendered by an app
that registers no navigation entry (typical for files integration apps
like drawio) logged a PHP warning per page view:

    Undefined array key "drawio" at lib/private/NavigationManager.php#432

Returning null explicitly keeps the behaviour identical for every
caller - the expression already evaluated to null after the warning -
and removes the log noise.

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@solracsf
solracsf requested a review from a team as a code owner July 21, 2026 10:08
@solracsf
solracsf requested review from Altahrim, come-nc, leftybournes and salmart-dev and removed request for a team July 21, 2026 10:08
@solracsf solracsf added this to the Nextcloud 35 milestone Jul 21, 2026
@solracsf solracsf added bug 3. to review Waiting for reviews labels Jul 21, 2026
@solracsf

Copy link
Copy Markdown
Member Author

/backport to stable34

@solracsf

Copy link
Copy Markdown
Member Author

/backport to stable33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant