Skip to content

Commit bab7208

Browse files
Merge pull request #19 from kodus/bugfix/deprecation-warnings-on-preg-match-calls
Fixed deprecation warnings from calling preg_match() with null values
2 parents f096f26 + 1f342ae commit bab7208

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Message.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ public function getText(): ?string
324324
*/
325325
public function setText(?string $text): void
326326
{
327-
if (preg_match('//u', $text) !== 1) {
327+
if (preg_match('//u', $text ?? '') !== 1) {
328328
throw new InvalidArgumentException("message body contains an invalid UTF-8 byte sequence");
329329
}
330330

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

0 commit comments

Comments
 (0)