From 2b647b8ef7bb3be67b3b63616b9988de697744f6 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sat, 10 Apr 2010 13:41:57 -0400 Subject: [PATCH] Need to push $app onto the stack before loading it's preferences. Prevents fatal errors due to autoloading not being setup for the app. --- horde/lib/Api.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/horde/lib/Api.php b/horde/lib/Api.php index 7e3ab5df6..0204a417c 100644 --- a/horde/lib/Api.php +++ b/horde/lib/Api.php @@ -155,8 +155,14 @@ class Horde_Api extends Horde_Registry_Api */ public function getPreference($app, $pref) { + $pushed = $GLOBALS['registry']->pushApp($app); $GLOBALS['registry']->loadPrefs($app); - return $GLOBALS['prefs']->getValue($pref); + $value = $GLOBALS['prefs']->getValue($pref); + if ($pushed) { + $GLOBALS['registry']->popApp(); + } + + return $value; } /** @@ -169,8 +175,12 @@ class Horde_Api extends Horde_Registry_Api */ public function setPreference($app, $pref, $value) { + $pushed = $GLOBALS['registry']->pushApp($app); $GLOBALS['registry']->loadPrefs($app); - return $GLOBALS['prefs']->setValue($pref, $value); + $value = $GLOBALS['prefs']->setValue($pref, $value); + if ($pushed) { + $GLOBALS['registry']->popApp(); + } } /** -- 2.11.0