mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 14:23:17 -04:00
Appropriate length check in Notification.php
There is an issue(bug) when using UTF-8 symbols in any method, which checks the length of string as `isset($id[64])`. You can set only 32 UTF-8 symbols because they are 2 byte, and this "array" check seems inapropriate in this case, as it throws unexpected exceptions. Signed-off-by: natoponen <57988162+natoponen@users.noreply.github.com>
This commit is contained in:
parent
0f3fdced4f
commit
bd7a1e4dcb
1 changed files with 2 additions and 2 deletions
|
|
@ -197,12 +197,12 @@ class Notification implements INotification {
|
|||
* @since 8.2.0 - 9.0.0: Type of $id changed to string
|
||||
*/
|
||||
public function setObject(string $type, string $id): INotification {
|
||||
if ($type === '' || isset($type[64])) {
|
||||
if ($type === '' || mb_strlen($type) > 64) {
|
||||
throw new \InvalidArgumentException('The given object type is invalid');
|
||||
}
|
||||
$this->objectType = $type;
|
||||
|
||||
if ($id === '' || isset($id[64])) {
|
||||
if ($id === '' || mb_strlen($id) > 64) {
|
||||
throw new \InvalidArgumentException('The given object id is invalid');
|
||||
}
|
||||
$this->objectId = $id;
|
||||
|
|
|
|||
Loading…
Reference in a new issue