Skip to content

Commit 36fddbd

Browse files
committed
Strengthen range of emoji characters
Signed-off-by: Matt Friedman <maf675@gmail.com>
1 parent 4e5e02a commit 36fddbd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

json/sanitizer.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,18 @@ public static function decode(string $json) : array
5454

5555
/**
5656
* Remove emoji from a string
57+
* Basic emoji (U+1F300 to U+1F64F)
58+
* Transport and map symbols (U+1F680 to U+1F6FF)
59+
* Miscellaneous symbols and pictographs (U+1F300 to U+1F5FF)
60+
* Additional emoji symbols (U+1F600 to U+1F64F)
5761
*
5862
* @param string $string
5963
* @return string
6064
*/
6165
public static function strip_emoji(string $string) : string
6266
{
6367
return preg_replace(
64-
'/[\x{1F000}-\x{1F9FF}]|[\x{2600}-\x{27FF}]/u',
68+
'/[\x{1F000}-\x{1F9FF}]|[\x{2600}-\x{27FF}]|[\x{1F300}-\x{1F64F}]|[\x{1F680}-\x{1F6FF}]/u',
6569
'',
6670
html_entity_decode($string, ENT_QUOTES, 'UTF-8')
6771
);

0 commit comments

Comments
 (0)