Sessions
-
I am storing an array in a $_SESSION variable–just random information, nothing that needs security. I added $_SESSION to the list of not-unset globals in wp-settings and moved the start_session() statement to various places will testing.
The behavior involves a flawless insertion of the array into $_SESSION[‘junk’] in a file named session.php that’s on the same directory as wordpress, which is site.com/wordpress/session.php.
I have a file for playing with the array at site.com/session_test.php. The array and the session ID show up every time there.
And then I use the session variable at functions.php and my theme files. These files seem to just pick random times to read the variable. As I navigate around, the array shows up just as it had been inserted originally, then the next page I go to, it is missing. Then the next it is back. Then it is unset and won’t show up anywhere and needs to be re-set. On each page, the session ID will print out the same each time. It’s just the variable that disappears eventually (usually after showing up sporadically a few times.)
Is this a server problem, a problem of different directories, or just some WordPress handling of sessions I don’t understand. Has anyone had experience with this?
The topic ‘Sessions’ is closed to new replies.