Session breaks Entity API Whenever I try to use $_SESSION or variable_set it breaks the Entity API. It says 


  "Fatal error: Call to undefined function entity_get_info() in
  mydrupal\sites\all\modules\entity\includes\entity.inc on line 55"


And then I have to reinstall the entire website because this fatal error shows up on every page. So I can't even access any of the adminscreens or anything to uninstall the modules or anything.

Does anybody here know if this is just a bug or am I doing something wrong? I was just filling the session with an entity.
Variables are serialised (as are session writes as I understand it), and complex objects like entity API entities don't serialise well.

The better solution would be to store the entity type and ID in the session, then load it when reading:

$_SESSION['saved_entity'] = array('type' =&gt; 'node', 'id' =&gt; 1);

...

$saved_entity = entity_load($_SESSION['saved_entity']['type'], array($_SESSION['saved_entity']['id']));


And do the same thing for the variables.