fix(prefs): guard config-file storage against null $registry global#195
Merged
Merged
Conversation
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
Horde_Core_Prefs_Storage_Configuration::get()reaches out toglobal $registryto loadprefs.phpdefaults. Under modern PSR-15 request paths (e.g. the admin REST API —Horde\Horde\Admin\UserController::get()→IdentityService::getAll()→SqlPrefsService::getValue()),$GLOBALS['registry']is never populated and the class fatals withCall to a member function loadConfigFile() on null.Add a guard: when
$registryisn't aHorde_Registryinstance, return$scope_obunchanged. Same graceful fallback shape the existingtry/catchuses whenprefs.phpdoesn't exist. Downstream storage drivers (SQL etc.) still supply real user preferences.Reproducer against a locally-installed Horde:
Config-file defaults are best-effort atop user prefs. When we can't reach the registry to load them, "skip defaults, fall through to real storage" is the right degrade.
Reported while dogfooding
hordectl webserver-configin horde/hordectl PR #17 CI. Surfaces on any admin REST API call that touchesIdentityService.