Skip to content

Commit

Permalink
Merge pull request PHPMailer#656 from MikkelPaulson/fix-regex-issues
Browse files Browse the repository at this point in the history
Fixed issues with regular expressions
  • Loading branch information
Synchro committed Mar 15, 2016
2 parents f0b2877 + 355d957 commit e8717f4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions class.phpmailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ protected function edebug($str)
case 'echo':
default:
//Normalize line breaks
$str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
$str = preg_replace('/\r\n?/ms', "\n", $str);
echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
"\n",
"\n \t ",
Expand Down Expand Up @@ -3297,7 +3297,7 @@ public function msgHTML($message, $basedir = '', $advanced = false)
$message
);
}
} elseif (substr($url, 0, 4) !== 'cid:' && !preg_match('#^[A-z]+://#', $url)) {
} elseif (substr($url, 0, 4) !== 'cid:' && !preg_match('#^[a-z][a-z0-9+.-]*://#i', $url)) {
// Do not change urls for absolute images (thanks to corvuscorax)
// Do not change urls that are already inline images
$filename = basename($url);
Expand Down Expand Up @@ -3681,7 +3681,7 @@ public function DKIM_HeaderC($signHeader)
foreach ($lines as $key => $line) {
list($heading, $value) = explode(':', $line, 2);
$heading = strtolower($heading);
$value = preg_replace('/\s+/', ' ', $value); // Compress useless spaces
$value = preg_replace('/\s{2,}/', ' ', $value); // Compress useless spaces
$lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value
}
$signHeader = implode("\r\n", $lines);
Expand Down

0 comments on commit e8717f4

Please sign in to comment.