Skip to content

Commit 933640d

Browse files
committed
Change usage of deprecated contstant FILTER_SANITIZE_STRING to htmlspecialchars and strip_tags
1 parent 8296a18 commit 933640d

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

src/Message.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -610,15 +610,7 @@ protected function filterName(string $name): string
610610
'>' => ']',
611611
];
612612

613-
$filtered = filter_var(
614-
$name,
615-
FILTER_SANITIZE_STRING,
616-
FILTER_FLAG_NO_ENCODE_QUOTES
617-
);
618-
619-
if ($filtered === false) {
620-
return '';
621-
}
613+
$filtered = htmlspecialchars(strip_tags($name), ENT_NOQUOTES);
622614

623615
return trim(strtr($filtered, $rules));
624616
}

tests/MessageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function testSetFrom()
4848
//filter_var return false
4949
$mock_filter_var_to_false = true;
5050
$e->setFrom($email, $name);
51-
$expected = '"=?UTF-8?B??=" <>';
51+
$expected = '"=?UTF-8?B?Bar?=" <>';
5252
$this->assertEquals($expected, $e->getFrom());
5353
}
5454

0 commit comments

Comments
 (0)