👴 Careful You’re reading an old article ! Some links might be broken and content may be outdated

I had a bug once, the sessions kept expiring even though the token was still valid.

I found out that CI_sessions were refreshing the session_id all the time. This was a database issue, be careful on the length of the columns in the database. The column that stored the session_id was too short and the token kept being re-generated since the old one couldn’t be recognized.

This was a tricky bug because it didn’t raise any obvious PHP error… Be careful with the schema of your database folks !