1

My question is inspired by an old problem that I don't think I properly resolved. I was storing array information in a Joomla session which I accessed a short time later. I found that intermittently the Joomla variable I had set was missing.

For interest you can see my original problem at https://stackoverflow.com/questions/13052495/how-to-prevent-race-conditions-when-writing-reading-joomla-session-variables-fr

I'm not going to ask the same question though, instead I was hoping to get answers for the following related questions.

  1. What could cause Joomla session data to intermittently go missing?
  2. How could I troubleshoot missing Joomla session variables?
4
  • 1
    Did you check the Session time in Joomla admin - Global Configuration - System ? The normal session period will be 15 minutes. After which, it will expire. If you close your browser, then session will expire. Apr 26, 2014 at 9:02
  • @RameshElamathi Yes. It was set for 15minutes. I was trying to access the variable prior to that (about 2-5minutes after variable was set).
    – TryHarder
    Apr 26, 2014 at 9:03
  • Then you got to check the code. You can troubleshoot by dumping the $_SESSION Apr 26, 2014 at 9:05
  • You also may want to check the PHP session vars, since the Joomla session just checks items into the PHP session.
    – user101289
    Apr 26, 2014 at 18:35

2 Answers 2

2

Bases on what I've seen, there are a few ways for session data to "go missing".

  1. The first way is exactly what people have mentioned or suggested already. This is where you hit the session timer boundary. Once the session timer is reached, the session is cleared from memory.

  2. When you log out, your session data is cleared. It depends on which log out function is called and which version of Joomla. I've seen some instances where only the Joomla Session part is cleared. I've also seen instances where the entire $_SESSION global is cleared.

  3. I have also seen some instances of trying to store session data via the Joomla APIs not store anything at all or it stores it in a place you don't expect. After you set a session variable, dump the session to make sure it is set and where you think it is.

  4. This one is more common for random missing session data. This is when you hit the www/non-www or the http/https boundary. Apache (the primary web server for Joomla sites) sometimes gets confused when the same browser crosses the www/non-www or http/https boundary. Some set ups handle it just fine, others don't but it is pretty common. Here's the interesting part, it doesn't even have to be the main link they are linking to that crosses that bridge, it could be an included CSS, JS file, image, etc on the same page that is across the www/non-www or http/https bridge that could be causing the problem. That is very rare these days but I've seen it on more than one site.

These are the only ways I can think of off the bat that could show this behavior.

1

Another possibility is that session data is truncated due to language characters. If storing in the db check the session data is complete (properly enclosed { }).

For example, if session tries to store Montréal it may get truncated to Montr. Everything after Montr is lost and session data can longer be updated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.