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

replaceOrgTokens: Remove broken code #19543

Merged
merged 1 commit into from
Apr 8, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Feb 5, 2021

Overview

I'm not sure how far up the chain this breakage goes - but this removes the
clearly broken part & comments further on it

Before

Code exists that would fatal if called

image

After

poof

Technical Details

I'm not sure how far up the chain this breakage goes - but this removes the
clearly broken part & comments further on it

Comments

@jmcclelland this code is called from

$str = CRM_Utils_Token::replaceOrgTokens($str, $org);
- are you able to confirm whether than function is hit (& it's just the removed part that was seemingly never hit) or whether there is more that can go - since you seem to use the bulk sms flow

I'm not sure how far up the chain this breakage goes - but this removes the
clearly broken part & comments further on it
@civibot
Copy link

civibot bot commented Feb 5, 2021

(Standard links)

@civibot civibot bot added the master label Feb 5, 2021
@jmcclelland
Copy link
Contributor

This is a real head scratcher. I can confirm that CRM_Utils_Token::replaceOrgTokens is being called. In my tests, though, it by-passes most of the code based on this test:

if (!self::token_match('org', $token, $str)) {
          continue;
}

That tests always results in the continue statement being executed becuase non of the tokens I can select start with "org.". I don't know how to get an {org.ANYTHING} token into the SMS unless I type it manually. I'm not sure why you would ever send an SMS to an organization contact, but maybe that's not an assumption we can make.

Also, what about the $org parameter? The calling function doesn't seem to set that parameter, which seems like it will cause this function to fail, since it depends on that array containing data.

@mattwire mattwire changed the title Remove broken code replaceOrgTokens: Remove broken code Feb 7, 2021
@eileenmcnaughton
Copy link
Contributor Author

@colemanw you can balance the line add with this line remove if you want :-)

@eileenmcnaughton
Copy link
Contributor Author

Note this is the function that doesn't exist

image

@colemanw
Copy link
Member

colemanw commented Apr 8, 2021

If it's been broken since 2015, best not think too hard about it.

@eileenmcnaughton eileenmcnaughton merged commit 9b7fe90 into civicrm:master Apr 8, 2021
@eileenmcnaughton eileenmcnaughton deleted the msg_tpl branch April 8, 2021 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants