Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>
  • Loading branch information
natoponen authored and backportbot-nextcloud[bot] committed Nov 11, 2022
commit d4f9b8286afa3787b5ac0240198667b2376a3521
4 changes: 2 additions & 2 deletions lib/private/Notification/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ public function getDateTime(): \DateTime {
* @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;
Expand Down