CRM-17953 URLs in CiviMail messages do not work

    Details

    • Documentation Required?:
      None
    • Funding Source:
      Core Team Funds

      Description

      All external urls in Civimail mailings cause a 500 error when clicked.

      I have traced the source of the error to line 441 in CRM/Utils/System.php.
      This is my suggested patch, simply replacing the problem line with the previous version, but I don't know whether this affects anything else:
      – self::setHttpHeader('Location', $url);
      ++ header('Location: ' . $url);

      I've not tried to replicate on the demo site, as I don't think that allows for mailings to be sent out

        Attachments

          Issue Links

            Activity

            [CRM-17953] URLs in CiviMail messages do not work
            John K. added a comment - - edited

            I receive this fatal error on localhost:
            Fatal error: Call to undefined function drupal_add_http_header() in C:\xampp\htdocs\civi\sites\all\modules\civicrm\CRM\Utils\System\Drupal.php on line 789

            Confirmed this on dmaster, so I'm escalating it.

            It doesn't just affect external URLs, it's all URLs.

            This will be because Drupal is not bootstrapped when we hit the scripts in extern/ and it's trying to use a Drupal function. So the proposed fix does do the job - but where else is this going to be broken?

            John K. added a comment -

            Source of this regression: CRM-12527

            Agileware added a comment -

            Confirmed this problem in 4.7.1. This issue breaks Mailings, click tracking as well as the ability for the user to click on ANY URLs in the mailing - white screen.

            Anyone upgraded to CiviCRM 4.7.1 who have sent out a mailing in the past will be impacted by this issue. Mailings with unclickable URLs is really bad news.

            John K. added a comment -

            A fuller solution may well be required - I need to check what else might be broken, but there's a 'hotfix' for the issue here:
            https://github.com/civicrm/civicrm-core/pull/7799

            John K. added a comment - - edited

            Coleman, do you have time to take a look at the implications of this?

            I think that was the only 'Location' header that was rewritten as part of CRM-12527

            Coleman Watts added a comment -

            Thanks John, that got me on the right track, but I think this is a more targeted fix: https://github.com/civicrm/civicrm-core/pull/7800
            (although I don't think either fix is going to break anything - if you've patched your site already with the hotfix, that ought to be fine)

            John K. added a comment -

            Looks more comprehensive, thanks for picking this up

            Coleman Watts added a comment -

            Actually, it would be super helpful if someone could try https://github.com/civicrm/civicrm-core/pull/7800 and report back here with a thumbs up.

            Aodhagán Collins added a comment - - edited

            @Coleman Watts I have tried your fix by patching my CiviCRM installation and it seems to work. Links in emails function again.

            John Tymoski added a comment - - edited

            Neither solution worked for me.

            Original error:
            Fatal error: Call to undefined function drupal_add_http_header() in /sites/all/modules/civicrm/CRM/Utils/System/Drupal.php on line 789

            Editing CRM/Utils/System.php I get:
            Warning: Cannot modify header information - headers already sent by (output started at /sites/default/civicrm.settings.php:1) in /sites/all/modules/civicrm/CRM/Utils/System.php on line 442

            Editing extern/url.php I get:
            Warning: Cannot modify header information - headers already sent by (output started at /sites/default/civicrm.settings.php:1) in /sites/all/modules/civicrm/extern/url.php on line 59

            John K. added a comment -

            Hmn, that sounds like a different error John.

            Sounds like a problem in your settings file. Could you check what's on line 1 of civicrm.settings.php? It should start with <?php and then go straight into a comment block. Perhaps the best place to pose this question is on StackExchange, and we can offer support there so that others who run into the issue can benefit too =] http://civicrm.stackexchange.com/

            John Tymoski added a comment -

            Thank you John K. After deleting spaces in front of the <?php in my settings file, the solution at https://github.com/civicrm/civicrm-core/pull/7800 worked for me.

              People

              • Assignee:
                Coleman Watts
                Reporter:
                Stuart Parker

                Dates

                • Created:
                  Updated:
                  Resolved: