Skip to content

Commit

Permalink
Fix userid casting in notifications
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
  • Loading branch information
skjnldsv committed Jun 11, 2019
1 parent 1470739 commit 490d1f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/private/Notification/Notification.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare (strict_types = 1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
Expand Down Expand Up @@ -133,7 +134,7 @@ public function __construct(IValidator $richValidator) {
* @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');
}
Expand All @@ -155,7 +156,7 @@ public function getApp() {
* @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');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Repair/RemoveLinkShares.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private function sendNotification(): void {

$users = array_keys($this->userToNotify);
foreach ($users as $user) {
$notification->setUser($user);
$notification->setUser((string) $user);
$this->notificationManager->notify($notification);
}
}
Expand Down

0 comments on commit 490d1f0

Please sign in to comment.