Skip to content

Commit

Permalink
Strengthen range of emoji characters
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Friedman <[email protected]>
  • Loading branch information
iMattPro committed Dec 4, 2024
1 parent 4e5e02a commit 36fddbd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion json/sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,18 @@ public static function decode(string $json) : array

/**
* Remove emoji from a string
* Basic emoji (U+1F300 to U+1F64F)
* Transport and map symbols (U+1F680 to U+1F6FF)
* Miscellaneous symbols and pictographs (U+1F300 to U+1F5FF)
* Additional emoji symbols (U+1F600 to U+1F64F)
*
* @param string $string
* @return string
*/
public static function strip_emoji(string $string) : string
{
return preg_replace(
'/[\x{1F000}-\x{1F9FF}]|[\x{2600}-\x{27FF}]/u',
'/[\x{1F000}-\x{1F9FF}]|[\x{2600}-\x{27FF}]|[\x{1F300}-\x{1F64F}]|[\x{1F680}-\x{1F6FF}]/u',
'',
html_entity_decode($string, ENT_QUOTES, 'UTF-8')
);
Expand Down

0 comments on commit 36fddbd

Please sign in to comment.