diff --git a/dev/TestSession.php b/dev/TestSession.php index 158554b06..5b831ee39 100644 --- a/dev/TestSession.php +++ b/dev/TestSession.php @@ -29,6 +29,10 @@ class TestSession { } function __destruct() { + // Shift off anything else that's on the stack. This can happen if something throws + // an exception that causes a premature TestSession::__destruct() call + while(Controller::curr() != $this->controller) Controller::curr()->popCurrent(); + $this->controller->popCurrent(); }