Skip to content

Commit

Permalink
dev/drupal#98 Fix masquerade issue caused by drupal update change
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Jan 1, 2020
1 parent 392f716 commit 9b41879
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CRM/Core/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ class CRM_Core_Session {
*/
protected $_session = NULL;

/**
* Current php Session ID : needed to detect if the session is changed
*
* @var string
*/
protected $sessionID;

/**
* We only need one instance of this object. So we use the singleton
* pattern and cache the instance in this variable
Expand Down Expand Up @@ -88,6 +95,11 @@ public static function &singleton() {
* Is this a read operation, in this case, the session will not be touched.
*/
public function initialize($isRead = FALSE) {
// remove $_SESSION reference if session is changed
if (($sid = session_id()) !== $this->sessionID) {
$this->_session = NULL;
$this->sessionID = $sid;
}
// lets initialize the _session variable just before we need it
// hopefully any bootstrapping code will actually load the session from the CMS
if (!isset($this->_session)) {
Expand Down

0 comments on commit 9b41879

Please sign in to comment.