Base singleton class of the MidCOM sessioning service.

This is a singleton class, that is accessible through the MidCOM Service infrastructure. It manages session data of MidCOM driven applications.

This class provides a generic interface to store keyed session values in the domain of the corresponding component.

All requests involving this service will always be flagged as no_cache.

If you store class instances within a session, which is perfectly safe in general, there are known problems due to the fact, that a class declaration has to be available before it can be deserialized. As PHP sessioning does this deserialization automatically, this might fail with MidCOM, where the sequence in which the code gets loaded and the sessioning gets started up is actually undefined. To get around this problems, the sessioning system stores not the actual data in the sessioning array, but a serialized string of the data, which can always be deserialized on PHP sessioning startup (its a string after all). This has an important implication though: The sessioning system always stores copies of the data, not references. So if you put something in to the session store and modify it afterwards, this change will not be reflected in the sessioning store.


Do never create an instance of this class directly. This is handled by the framework. Instead use midcom_service_session which ensures the singleton pattern.

Do never work directly with the $_SESSION["midcom_session_data"] variable, this is a 100% must-not, as this will break functionality.


No public properties found
No constants found
No protected methods found
No protected properties found
No private methods found
No private properties found





get(string  $key, mixed  $default = null) : mixed

Returns a value from the session.

Returns null if the key is non-existent. Note, that this is not necessarily a valid non-existence check, as the sessioning system does allow null values. Use the exists function if unsure.


string $key

The key to query.

mixed $default


mixed —

The session key's data value, or null on failure.


set(mixed  $key, mixed  $value) 

This will store the value to the specified key.


mixed $key

Session value identifier.

mixed $value

Session value.