Skip to content
Permalink
Browse files

regexp: \z replaced with D modifier

  • Loading branch information...
dg committed Jul 11, 2019
1 parent 82fb366 commit 1dd2dca6c10498b99681a2039e70e5d98cce5e31
Showing with 5 additions and 5 deletions.
  1. +3 −3 src/Mail/Message.php
  2. +1 −1 src/Mail/MimePart.php
  3. +1 −1 src/Mail/SmtpMailer.php
@@ -141,7 +141,7 @@ public function addBcc(string $email, string $name = null)
*/
private function formatEmail(string $email, string $name = null): array
{
if (!$name && preg_match('#^(.+) +<(.*)>\z#', $email, $matches)) {
if (!$name && preg_match('#^(.+) +<(.*)>$#D', $email, $matches)) {
[, $name, $email] = $matches;
$name = stripslashes($name);
$tmp = substr($name, 1, -1);
@@ -208,7 +208,7 @@ public function setHtmlBody(string $html, string $basePath = null)
|<body[^<>]*\s background\s*=\s*
|<[^<>]+\s style\s*=\s* ["\'][^"\'>]+[:\s] url\(
|<style[^>]*>[^<]+ [:\s] url\()
(["\']?)(?![a-z]+:|[/\\#])([^"\'>)\s]+)
(["\']?)(?![a-z]+:|[/\#])([^"\'>)\s]+)
|\[\[ ([\w()+./@~-]+) \]\]
#ix',
PREG_OFFSET_CAPTURE
@@ -385,7 +385,7 @@ public function build()
protected function buildText(string $html): string
{
$text = Strings::replace($html, [
'#<(style|script|head).*</\\1>#Uis' => '',
'#<(style|script|head).*</\1>#Uis' => '',
'#<t[dh][ >]#i' => ' $0',
'#<a\s[^>]*href=(?|"([^"]+)"|\'([^\']+)\')[^>]*>(.*?)</a>#is' => '$2 &lt;$1&gt;',
'#[\r\n]+#' => ' ',
@@ -131,7 +131,7 @@ public function getEncodedHeader(string $name): ?string
}
return ltrim(substr($s, 0, -1)); // last comma
} elseif (preg_match('#^(\S+; (?:file)?name=)"(.*)"\z#', $this->headers[$name], $m)) { // Content-Disposition
} elseif (preg_match('#^(\S+; (?:file)?name=)"(.*)"$#D', $this->headers[$name], $m)) { // Content-Disposition
$offset += strlen($m[1]);
return $m[1] . '"' . self::encodeHeader($m[2], $offset) . '"';
@@ -74,7 +74,7 @@ public function __construct(array $options = [])
if (isset($options['clientHost'])) {
$this->clientHost = $options['clientHost'];
} else {
$this->clientHost = isset($_SERVER['HTTP_HOST']) && preg_match('#^[\w.-]+\z#', $_SERVER['HTTP_HOST'])
$this->clientHost = isset($_SERVER['HTTP_HOST']) && preg_match('#^[\w.-]+$#D', $_SERVER['HTTP_HOST'])
? $_SERVER['HTTP_HOST']
: 'localhost';
}

0 comments on commit 1dd2dca

Please sign in to comment.
You can’t perform that action at this time.