Skip to content

Commit

Permalink
Merge pull request #19 from kodus/bugfix/deprecation-warnings-on-preg…
Browse files Browse the repository at this point in the history
…-match-calls

Fixed deprecation warnings from calling preg_match() with null values
  • Loading branch information
thomasnordahl-dk authored May 22, 2024
2 parents f096f26 + 1f342ae commit bab7208
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 bab7208

Please sign in to comment.