Fix userid casting in notifications

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2019-06-11 09:52:04 +02:00
parent 147073911f
commit 49d5030a53
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
3 changed files with 7 additions and 5 deletions

View File

@ -1,4 +1,5 @@
<?php
declare (strict_types = 1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@ -133,7 +134,7 @@ class Notification implements INotification {
* @throws \InvalidArgumentException if the app id is invalid
* @since 8.2.0
*/
public function setApp($app) {
public function setApp(string $app) {
if (!is_string($app) || $app === '' || isset($app[32])) {
throw new \InvalidArgumentException('The given app name is invalid');
}
@ -155,7 +156,7 @@ class Notification implements INotification {
* @throws \InvalidArgumentException if the user id is invalid
* @since 8.2.0
*/
public function setUser($user) {
public function setUser(string $user) {
if (!is_string($user) || $user === '' || isset($user[64])) {
throw new \InvalidArgumentException('The given user id is invalid');
}

View File

@ -196,7 +196,7 @@ class RemoveLinkShares implements IRepairStep {
$users = array_keys($this->userToNotify);
foreach ($users as $user) {
$notification->setUser($user);
$notification->setUser((string) $user);
$this->notificationManager->notify($notification);
}
}

View File

@ -1,4 +1,5 @@
<?php
declare (strict_types = 1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@ -36,7 +37,7 @@ interface INotification {
* @throws \InvalidArgumentException if the app id is invalid
* @since 9.0.0
*/
public function setApp($app);
public function setApp(string $app);
/**
* @return string
@ -50,7 +51,7 @@ interface INotification {
* @throws \InvalidArgumentException if the user id is invalid
* @since 9.0.0
*/
public function setUser($user);
public function setUser(string $user);
/**
* @return string