Calling Yii::$app->session->get() method deletes my variable

I have been experiencing this problem for a while now and I finally got around to investigation it. I have no idea why this happens but it looks to be a bug in the Yii2 framework.

I have a session variable that gets erased as soon as I try to call the "get" method on it. I have stepped through the code in a debugger and the session variable exists right up until the time the get method is called on it. I tried troubleshooting this problem by grabbing the session variable using, $_SESSION["myVariable"] and it works. This leads me to believe there is a bug in the Yii::$app->session class. I have used the Yii::$app->session class in a-lot of areas and only experience this bug in a few.

Does anyone know why this happens and can we get this fixed please?

If you feel there is an issue go here.

Make the life of your audience easier by mentioning exactly when, where and how the problem is happening in minimum words and you will get a fast solution.

Thanks Hrnair, I will report this if I get a chance to dig a bit deeper. I would have posted code samples but it wouldn’t have helped. It seems to happen completely randomly on rare occasions. I have no idea why.