If you have an idea of how to fix a bug or develop something new, start with the most simple, crude and reliable way of implementing it in order to demonstrate to yourself that the concept works. After you know the concept works, proceed with adding complexity and sophistication. Very useful with complex bugs.
If you can’t reproduce a certain bug, study only that part of the system so that you can get it to fail. If it’s a problem with the session, study the class(es) dealing with handling of the session. See what methods there are – is the session getting cached in the db? Is it getting cleared from $_SESSION in an attempt to save space? Is there anything in there that looks like it might be related to your bug? Studying those particular aspects of the system will hopefully give you enough understanding so that you can make the bug reproducible.
I was working in Varying Vagrant Vagrants and for some reason the site I was working on was starting to load extremely slowly after a certain amount of time. Not being able to pinpoint the causes, I dumped VVV (which uses a lot of additional technology and configuration) in favor of Vagrant. On Vagrant I installed a bare-bones box with just the minimum required software and configurations. I simplified the environment. This helped me deal with the problem much better than before.
Ensure that you have a valid way to test whether what you are trying to do works or not. Maybe it is working but your way of checking it is wrong.
Before starting to debug something in order to fix it, first make sure that you understand how it is supposed to be working. Maybe it is working correctly but you are under the misunderstanding that it’s not working.