yiisoft/yii — pull request #2562 by gusnips (2013-06-17 05:14:02+00:00)
Title: Fixes problem when session is not closed

CApplication::end() may call exit which stops propagation and makes the other callbacks in register_shutdown_function to never run.
If the session needs to be closed always on the end of the request, which is my case using a custom session component, then whenever you call Yii::app()->end(0,true) cancel the session::close registered callback in register_shutdown_function by calling exit
This fix will fix it.