Created
December 30, 2013 15:02
Revisions
-
ericsk created this gist
Dec 30, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ /** * Callback function for session handler. It's invoked while the session data is being read. * * @param $sessionId The session ID. * * @return string The session data. It will retrun empty string if the session doesn't exist. */ public function read($sessionId) { try { // try to retrieve the session content first to see if it exists $result = $this->_tableRestProxy->getEntity($this->_sessionContainer, $this->_sessionContainerPartition, $sessionId); // get the entity instance $entity = $result->getEntity(); // deflat the serialized data return unserialize(base64_decode($entity->getPropertyValue('data'))); } catch (ServiceException $e) { // the entity doesn't exist, return empty string according to the spec: // http://www.php.net/manual/en/sessionhandlerinterface.read.php return ''; } }