Index: application.php =================================================================== --- application.php (revision 15250) +++ application.php (working copy) @@ -1887,7 +1887,12 @@ $session = $this->recallObject('Session'); /* @var $session Session */ - $this->HandleEvent(new kEvent('adm:OnBeforeShutdown')); + if ( $this->InitDone ) { + // if redirect happened in the middle of application initialization don't call event, + // that presumes that application was successfully initialized + $this->HandleEvent(new kEvent('adm:OnBeforeShutdown')); + } + $session->SaveData(); ob_end_flush();