Skip to content
Merged
Show file tree
Hide file tree
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
Fix userid casting in notifications
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
  • Loading branch information
skjnldsv committed Jun 11, 2019
commit 49d5030a532b811388c08a2340a6745255268107
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
5 changes: 3 additions & 2 deletions lib/public/Notification/INotification.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 @@ -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
Expand All @@ -50,7 +51,7 @@ public function getApp();
* @throws \InvalidArgumentException if the user id is invalid
* @since 9.0.0
*/
public function setUser($user);
public function setUser(string $user);

/**
* @return string
Expand Down