Index: branches/5.2.x/core/kernel/application.php =================================================================== diff -u -N -r15250 -r15251 --- branches/5.2.x/core/kernel/application.php (.../application.php) (revision 15250) +++ branches/5.2.x/core/kernel/application.php (.../application.php) (revision 15251) @@ -1,6 +1,6 @@ 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();