-
-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(dev/drupal#163) Session erroneously getting set to NULL on change #21403
(dev/drupal#163) Session erroneously getting set to NULL on change #21403
Conversation
(Standard links)
|
Can one of the admins verify this patch? |
@@ -171,9 +163,9 @@ public function reset($all = 1) { | |||
unset($this->_session[$this->_key]); | |||
} | |||
else { | |||
$this->_session = []; | |||
$this->_session[$this->_key] = []; | |||
unset($this->_session); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't this unset
nuke the $_SESSION
, because $this->_session
is a reference to that variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
Short Example:
$a = 1;
$b = &$a;
$b++;
echo $a; // display 2
echo $b; // display 2
unset($b);
echo $a; // still display 2
echo $b; // undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh - right, make sense, merci :)
jenkins, test this please |
add to whitelist |
unfortunately there are very few tests on sessions ( |
Test error:
|
Just noting that we should check that dev/drupal#98 is still fixed as per this PR 9b41879 which added in the session_id handing |
…d by the CRM. Ensures that CRM_Core_Session::_session is still a valid reference to $_SESSION.
bd83880
to
1fa3e6a
Compare
I wasn't able to easily test d7 yet - but FWIW I was able to masquerade correctly in Drupal 9.1.12 and Masquerade 8.x-2.0-beta4 both before and after this commit, however this does resolve our D9/Commerce checkout-with-login issue. |
Looks like |
Jenkins retest this please. My only thoughts on this one might be that maybe it allows a malicious module/extension to access non-civi parts of the anonymous session that haven't been cleared which might be from another person previously using the browser. But (a) that's generally true, and is why people are encouraged to close their browser when done on shared machines, and (b) are shared machines even still a thing. |
Jenkins retest this please. |
Session erroneously getting set to NULL on change (Drupal user login)
Overview
In some cases (ie drupal login / user impersonation (masquerade) / login with externalAuth...), the session id change and CiviCRM remove all the data from $_SESSION, included data out of 'CiviCRM' scope.
Before
After
Technical Details
This issue is a consequence of previous PR from (dev/drupal#98) that managed to fix CRM_Core_Session::_session reference issue. When masquerading with Drupal 7, the $_SESSION change and the CRM_Core_Session::_session doesn't refer the new $_SESSION array.
This PR purposes are: