I've been wondering this for a while now.
What are the differences between Joomla sessions and php sessions? Are they interchangeable?
Joomla Stack Exchange is a question and answer site for Joomla! administrators, users, developers and designers. It only takes a minute to sign up.
Sign up to join this communityJSession is based on the standard PHP session handling mechanism but I would not say they are interchangeable, as Joomla is directly "talking" to JSession and not to the super global.
In backend you select a session handler (the default being the database) where Joomla will store session related informations, basically it's serializing the content of $_SESSION
itself.
When a cookie is sent, no actual readable data is stored, just a session identifier.
It also provides a very simple, namespaced interface to store and retrieve data from the user session. Read an entire article about this on ostraining.
$_SESSION
superglobal, it's just that Joomla creates a custom session handler and wraps the setting/getting of $_SESSION properties with its own methods. If the data is not in $_SESSION then Joomla is doing something very non-PHP like?
Joomla uses the PHP session functions to create its JSession
object, but it provides wrapper functions and namespaces the session to keep the data segregated. If you dump the PHP superglobal $_SESSION
you will see the Joomla session items.