Skip to content

Commit

Permalink
Fixed deprecation warnings from calling preg_match() with null values
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasnordahl-dk committed Jan 3, 2024
1 parent e391f2b commit 1f342ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public function getText(): ?string
*/
public function setText(?string $text): void
{
if (preg_match('//u', $text) !== 1) {
if (preg_match('//u', $text ?? '') !== 1) {
throw new InvalidArgumentException("message body contains an invalid UTF-8 byte sequence");
}

Expand All @@ -346,7 +346,7 @@ public function getHTML(): ?string
*/
public function setHTML(?string $html): void
{
if (preg_match('//u', $html) !== 1) {
if (preg_match('//u', $html ?? '') !== 1) {
throw new InvalidArgumentException("message body contains an invalid UTF-8 byte sequence");
}

Expand Down

0 comments on commit 1f342ae

Please sign in to comment.