Skip to content

Fix fatal error on admin settings page: OC\Server magic getters removed#351

Closed
nd- wants to merge 1 commit into
CollaboraOnline:masterfrom
nd-:fix/oc-server-magic-getters-removed
Closed

Fix fatal error on admin settings page: OC\Server magic getters removed#351
nd- wants to merge 1 commit into
CollaboraOnline:masterfrom
nd-:fix/oc-server-magic-getters-removed

Conversation

@nd-

@nd- nd- commented Jul 21, 2026

Copy link
Copy Markdown

Problem

On Nextcloud core versions where the legacy magic getters have been removed from OC\Server (confirmed on Nextcloud 34.0.1), loading the admin settings page at /settings/admin/richdocumentscode throws a fatal error:

Call to undefined method OC\Server::getURLGenerator()
  in apps/richdocumentscode/lib/Settings/Admin.php:36

Admin::getForm() also calls \OC::$server->getAppManager() (line 45), which is affected the same way and would fail right after the first call is fixed.

info.xml declares max-version="35", so the app is expected to work on this core version, but these two direct magic-getter calls were never migrated to the DI container's get() method like the rest of the app already does elsewhere.

Fix

Replace both calls with \OC::$server->get(SomeInterface::class), which is the supported way to fetch services from the container and remains stable across core versions (confirmed present via SimpleContainer::get()).

Testing

Verified on a Nextcloud 34.0.1 instance: the admin settings page now renders without error after this change.

@nd-

nd- commented Jul 21, 2026

Copy link
Copy Markdown
Author

Duplicate of #345, which fixes the same underlying issue (#344) in the same file. Closing in favor of that PR — sorry for the noise, should have searched for existing PRs/issues first.

@nd- nd- closed this Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant