Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-74408

Ignore blank lines in email diversion exceptions

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.11.6
    • 3.11.8, 4.0.2
    • Email

    Description

      An accidental blank line in divertallemailsexcept causes no emails to be diverted.

      To reproduce:

      1. Enter an email address in divertallemailsto and an extra blank line in divertallemailsexcept
      2. Send a test email {siteurl}/admin/testoutgoingmailconf.php
      3. Receive the test email without a diversion applied

      The email in step 2 should be diverted because blank lines are easy to include in the multi-line entry for divertallemailsexcept and processing a blank line defeats the whole point of the setting. Therefore blank lines should be ignored.

      To fix, this line needs changing:

      https://github.com/moodle/moodle/blob/7ce003b666a66b465ce9335f430a6e4d3535a7f1/lib/moodlelib.php#L5876

      To

              if ($pattern != "" and preg_match("/$pattern/", $email)) {

      Attachments

        Activity

          People

            pholden Paul Holden
            JohnPercival John Percival
            Laurent David Laurent David
            Andrew Lyons Andrew Lyons
            CiBoT CiBoT
            David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11/Jul/22

              Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 5 minutes
                1h 5m