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

Fix e-notice & php8.2 issue on user dashboard #25545

Merged
merged 1 commit into from
Apr 19, 2023

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Fix e-notice & php8.2 issue on user dashboard

This addresses the first notice on the image below - but on looking I realised that there was also use of an undefined property. I removed it in favour of a function to be called.

Before

image

After

image

Technical Details

I also moved the validation into the getCheckSum function - the checksum is only returned if _contactId is set (I considered renaming the property to contactID but sometimes on CRM_Core_Form the 2 variables are used differently....) so it makes sense to validate before returning rather than remember in the calling code. The Contribution dash also calls this code but the extra check seems fine or even good

Comments

@civibot
Copy link

civibot bot commented Feb 9, 2023

(Standard links)

@civibot civibot bot added the master label Feb 9, 2023
if ($userChecksum) {
$this->assign('userChecksum', $userChecksum);
$validUser = CRM_Contact_BAO_Contact_Utils::validChecksum($this->_contactId, $userChecksum);
$this->_isChecksumUser = $validUser;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seamuslee001 this undeclared property would be php 8.2 incompatible

@@ -154,7 +151,7 @@ public function buildUserDashBoard() {
$this->assign('pcpInfo', $pcpInfo);
}

if (!empty($dashboardOptions['Assigned Activities']) && empty($this->_isChecksumUser)) {
if (!empty($dashboardOptions['Assigned Activities']) && !$this->getUserChecksum()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undeclared property replaced by function

*/
protected function getUserChecksum() {
$userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this);
if (empty($userID) && $this->_contactId) {
if ($this->_contactId && CRM_Contact_BAO_Contact_Utils::validChecksum($this->_contactId, $userChecksum)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related: https://lab.civicrm.org/dev/core/-/issues/2724 but I'd need to get my head back into it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right - I assume that we could put back in a getLoggedInUser check there then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@demeritcowboy I took a look at this again & I'm inclined to close https://lab.civicrm.org/dev/core/-/issues/2724 and keep this.

The usages of the return value are

  1. to determine it the contact can add themselve to groups - if they used a checksum link in the url then no.
  2. to decide whether to inclue a checksum in a url for the transact page - if checksum was used then yes.

The impact of this PR is
1 - unchanged. This does mean that if they authenticated by checksum AND are otherwise logged in they can't edit their groups. No-one noticed in the last year & my mind spins at what scenario this could matter in
2 - is slightly changed to 'if checksum was used & it is valid then yes by this pr

@eileenmcnaughton
Copy link
Contributor Author

test this please

@eileenmcnaughton
Copy link
Contributor Author

Test Result (1 failure / +1)api_v3_JobProcessMailingTest.testConcurrency with data set #1

Test Result (1 failure / +1)
api_v3_JobProcessMailingTest.testConcurrency with data set #1

@eileenmcnaughton
Copy link
Contributor Author

test this please - lets' get a fresh test run

@mattwire mattwire merged commit ae28b88 into civicrm:master Apr 19, 2023
@eileenmcnaughton eileenmcnaughton deleted the smarty_tpl2 branch April 20, 2023 03:41
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.

3 participants