Skip to content

Commit

Permalink
fix Message::bodySummary when preg_replace is broken
Browse files Browse the repository at this point in the history
preg_replace returns "false" on failure which interpreted as OK result which is wrong.

Reform statement in positive manner makes it right
  • Loading branch information
Sergey Boborykin committed Apr 14, 2023
1 parent bfe7c39 commit 0565b25
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Message.php
Expand Up @@ -77,11 +77,11 @@ public static function bodySummary(MessageInterface $message, int $truncateAt =

// Matches any printable character, including unicode characters:
// letters, marks, numbers, punctuation, spacing, and separators.
if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/u', $summary)) {
return null;
if (preg_match('/[\pL\pM\pN\pP\pS\pZ\n\r\t]+/u', $summary)) {
return $summary;
}

return $summary;
return null;
}

/**
Expand Down

0 comments on commit 0565b25

Please sign in to comment.