If pushApp() doesn't succeed, be sure to clear the app off the stack.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 2 Dec 2009 02:21:28 +0000 (19:21 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 2 Dec 2009 02:21:28 +0000 (19:21 -0700)
framework/Core/lib/Horde/Registry.php

index 0a0b846..0c76f3c 100644 (file)
@@ -911,16 +911,22 @@ class Horde_Registry
             Horde::callHook('pushapp', array(), $app);
         } catch (Horde_Exception $e) {
             $e->setCode(self::HOOK_FATAL);
+            $this->popApp();
             throw $e;
         } catch (Horde_Exception_HookNotSet $e) {}
 
         /* Initialize application. */
         if ($checkPerms || !empty($options['init'])) {
-            if (file_exists($app_lib . '/base.php')) {
-                // TODO: Remove once there is no more base.php files
-                require_once $app_lib . '/base.php';
-            } else {
-                $this->callAppMethod($app, 'init');
+            try {
+                if (file_exists($app_lib . '/base.php')) {
+                    // TODO: Remove once there is no more base.php files
+                    require_once $app_lib . '/base.php';
+                } else {
+                    $this->callAppMethod($app, 'init');
+                }
+            } catch (Horde_Exception $e) {
+                $this->popApp();
+                throw $e;
             }
         }