Skip to content
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

Use singleton to get session instead of relying on ->_session being set elsewhere #14832

Merged
merged 1 commit into from
Jul 16, 2019

Conversation

mattwire
Copy link
Contributor

Overview

CRM_Profile_Form relies on $this->_session being set but we should just call CRM_Core_Session::singleton() and not worry about it.

Before

$this->_session must be set by calling class (eg. in GDPR extension). If it's not set we get a fatal error.

After

Use the standard CRM_Core_Session::singleton() method to get the session object - so we won't get fatal errors if the calling function hasn't set $this->_session.

Technical Details

Just switching to a more standard, more reliable method for this class.

Comments

@civibot
Copy link

civibot bot commented Jul 16, 2019

(Standard links)

@civibot civibot bot added the master label Jul 16, 2019
@colemanw
Copy link
Member

Makes sense to me. Caching an object that's already cached in a singleton isn't doing any good.

@colemanw colemanw merged commit 4e0d128 into civicrm:master Jul 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants