Fixes #3996: Traversing `Yii::$app->session` may cause a PHP error