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

(Regression) CRM_Mailing_ActionTokens - Degrade gracefully #9874

Merged
merged 1 commit into from
Feb 28, 2017

Conversation

totten
Copy link
Member

@totten totten commented Feb 22, 2017

Most of the CRM_*_Tokens classes include a checkActive() function which prevents them from trying to do anything if they don't have the necessary data. However, this one was missing it, which means that it attempts to evalute {action.*} tokens even when they're not valid.

Note: This was reported on Stack Exchange. As of this writing, I haven't had a chance to reproduce or test the fix in a full deployment, but I'm opening the PR to get the test-suite and discussion going.

@colemanw
Copy link
Member

@totten several test failures related to this.

Most of the `CRM_*_Tokens` classes include a `checkActive()` function whic
prevents them from trying to do anything if they don't have the necessary
data.  However, this one was missing it, which means that it attempts to
evalute `{action.*}` tokens even when they're not valid.
@totten
Copy link
Member Author

totten commented Feb 23, 2017

OK, I've updated and rebased. It now passes those tests locally.

@totten
Copy link
Member Author

totten commented Feb 23, 2017

The reported failure, CRM_Contact_BAO_ContactType_ContactTest.testCRM19133, is a common false-negative.

@totten
Copy link
Member Author

totten commented Feb 23, 2017

To test this with a real scheduled reminder, used this procedure;

  • Create an activity (scheduled meeting)
  • Create a scheduled-reminder (for scheduled meetings) with this body:
Hello

Optout: {action.optOutUrl}

Name: {contact.display_name}
  • Iteratively execute: echo 'delete from civicrm_action_log' | drush cvsqlc && cv api -U admin job.send_reminder

This procedure reproduced the hard-error (in master) and showed an improvement (in master-acttok).

In the case where one uses an invalid token, this PR doesn't provide a proper warning (that's a separate issue, CRM-20143). But at least we're back to not-crashing.

@eileenmcnaughton
Copy link
Contributor

test this please

@seamuslee001
Copy link
Contributor

@eileenmcnaughton I think this seems sane should this get merged in?

@eileenmcnaughton
Copy link
Contributor

It feels sane (esp due to the sanity of the committer) but I'm struggling to understand how to determine if it is safe

@totten
Copy link
Member Author

totten commented Feb 28, 2017

Yeah, I imagine that's tough if you haven't gotten your around the CRM_*_Tokens stuff. For a general reader, the main thing to note is

  • (a) it makes the class look more consistent with other/similar classes
  • (b) the manual test procedure (which i described above) shows better results
  • (c) this was new code in 4.7.16 which was intended to be inactive during most use-cases (it just wasn't properly deactivated).
  • (d) the tests still pass

@totten totten merged commit f5d8dda into civicrm:master Feb 28, 2017
@totten totten deleted the master-acttok branch February 28, 2017 02:26
monishdeb pushed a commit to monishdeb/civicrm-core that referenced this pull request May 2, 2017
(Regression) CRM_Mailing_ActionTokens - Degrade gracefully
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.

5 participants