Skip to content

Commit

Permalink
Allow short name field to accept multibyte chars, just not emoji
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 36fddbd commit 5a0c6c7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions event/listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,15 @@ public function validate_pwa_options($event)

$short_name = $event['cfg_array']['pwa_short_name'];

// Do not allow multibyte characters or emoji
if (strlen($short_name) !== mb_strlen($short_name, 'UTF-8'))
// Do not allow emoji
if (preg_match('/[\x{1F000}-\x{1F9FF}]|[\x{2600}-\x{27FF}]|[\x{1F300}-\x{1F64F}]|[\x{1F680}-\x{1F6FF}]|[\x{2700}-\x{27BF}]|[\x{FE00}-\x{FE0F}]/u', $short_name))
{
$this->add_error($event, 'PWA_SHORT_NAME_INVALID');
return;
}

// Do not allow strings longer than 12 characters
if (strlen($short_name) > 12)
if (mb_strlen($short_name, 'UTF-8') > 12)
{
$this->add_error($event, 'PWA_SHORT_NAME_INVALID');
return;
Expand Down

0 comments on commit 5a0c6c7

Please sign in to comment.