diff options
author | Vitor Mattos <vitor@php.rio> | 2022-01-17 15:14:56 +0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2022-01-21 14:39:41 +0300 |
commit | b9f74584a1e808019235d349fbae3f1fd1bdd711 (patch) | |
tree | 502bfce2e5ad076158b8e04b2471aaaaec02e0c6 | |
parent | c9f2f0077745da8d0570b387557076ce9c948dc4 (diff) |
Fix check after change from string to mb_string
Signed-off-by: Vitor Mattos <vitor@php.rio>
-rw-r--r-- | lib/private/Comments/Manager.php | 4 | ||||
-rw-r--r-- | tests/lib/Comments/ManagerTest.php | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index a8c4e2bf09e..e87ac5cd5cc 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -148,8 +148,8 @@ class Manager implements ICommentsManager { throw new \UnexpectedValueException('Actor, Object and Verb information must be provided for saving'); } - if ($comment->getVerb() === 'reaction' && mb_strlen($comment->getMessage()) > 8) { - throw new \UnexpectedValueException('Reactions cannot be longer than 8 bytes'); + if ($comment->getVerb() === 'reaction' && mb_strlen($comment->getMessage()) > 2) { + throw new \UnexpectedValueException('Reactions cannot be longer than 2 chars (emoji with skin tone have two chars)'); } if ($comment->getId() === '') { diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php index cba314e880b..d1d9a8a05d4 100644 --- a/tests/lib/Comments/ManagerTest.php +++ b/tests/lib/Comments/ManagerTest.php @@ -1144,6 +1144,7 @@ class ManagerTest extends TestCase { * @dataProvider providerTestReactionMessageSize */ public function testReactionMessageSize($reactionString, $valid) { + $this->skipIfNotSupport4ByteUTF(); if (!$valid) { $this->expectException(\UnexpectedValueException::class); } @@ -1162,8 +1163,8 @@ class ManagerTest extends TestCase { return [ ['a', true], ['1', true], - ['12345678', true], - ['123456789', false], + ['12', true], + ['123', false], ['👍', true], ['👍👍', true], ['👍🏽', true], |