Is there a list anywhere of all the session variables that Drupal inherently uses? I'll need to track around 9 additional variables, and want to make sure I'm not over-riding Drupal (some of them are only one letter long).


Jaypan’s picture

You need to namespace your variables. This will prevent conflicts. So if your module is named my_module:

$_SESSION['my_module']['some_variable'] = t('Something');
$_SESSION['my_module']['some_other_variable'] = t('Something else');

Module names must be unique, and therefore there will never be any clashes with any of Drupal's variables, nor with any other contributed module (well, ideally/theoretically).

Specializing in Drupal 8 upgrades. Checkout my Japan podcasts and my Drupal presentations on YouTube