On Mon, 4 Jan 2016 20:29:17 +0100, Sönke Ludwig wrote:

... to store the session data in a cookie

Very bad idea! It is unacceptable to mix session store and cookies, they are designed for different purposes.