Skip to content

Commit 84f45fe

Browse files
authored
[stable16] Fix userid casting in notifications (#15925)
[stable16] Fix userid casting in notifications
2 parents 9dfe777 + 9346718 commit 84f45fe

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

lib/private/Notification/Notification.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare (strict_types = 1);
23
/**
34
* @copyright Copyright (c) 2016, ownCloud, Inc.
45
*
@@ -133,7 +134,7 @@ public function __construct(IValidator $richValidator) {
133134
* @throws \InvalidArgumentException if the app id is invalid
134135
* @since 8.2.0
135136
*/
136-
public function setApp($app) {
137+
public function setApp(string $app) {
137138
if (!is_string($app) || $app === '' || isset($app[32])) {
138139
throw new \InvalidArgumentException('The given app name is invalid');
139140
}
@@ -155,7 +156,7 @@ public function getApp() {
155156
* @throws \InvalidArgumentException if the user id is invalid
156157
* @since 8.2.0
157158
*/
158-
public function setUser($user) {
159+
public function setUser(string $user) {
159160
if (!is_string($user) || $user === '' || isset($user[64])) {
160161
throw new \InvalidArgumentException('The given user id is invalid');
161162
}

lib/private/Repair/RemoveLinkShares.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ private function sendNotification(): void {
196196

197197
$users = array_keys($this->userToNotify);
198198
foreach ($users as $user) {
199-
$notification->setUser($user);
199+
$notification->setUser((string) $user);
200200
$this->notificationManager->notify($notification);
201201
}
202202
}

lib/public/Notification/INotification.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare (strict_types = 1);
23
/**
34
* @copyright Copyright (c) 2016, ownCloud, Inc.
45
*
@@ -36,7 +37,7 @@ interface INotification {
3637
* @throws \InvalidArgumentException if the app id is invalid
3738
* @since 9.0.0
3839
*/
39-
public function setApp($app);
40+
public function setApp(string $app);
4041

4142
/**
4243
* @return string
@@ -50,7 +51,7 @@ public function getApp();
5051
* @throws \InvalidArgumentException if the user id is invalid
5152
* @since 9.0.0
5253
*/
53-
public function setUser($user);
54+
public function setUser(string $user);
5455

5556
/**
5657
* @return string

0 commit comments

Comments
 (0)