Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/admin_notifications.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-03-25 15:06:50 +0300
committerJoas Schilling <coding@schilljs.com>2017-03-25 15:06:50 +0300
commit1bbfc14baab7afb17321c5bc5d381538ed141c25 (patch)
treeace99e22b6b354688d4415d6c901b01cabcd1e54
parent1d3adbdb54b036d2dc6afab021cfd311ffc9cdad (diff)
Make sure the parameters are always a string
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--lib/Controller/APIController.php2
-rw-r--r--tests/Controller/APIControllerTest.php1
2 files changed, 3 insertions, 0 deletions
diff --git a/lib/Controller/APIController.php b/lib/Controller/APIController.php
index e6b9266..31387c7 100644
--- a/lib/Controller/APIController.php
+++ b/lib/Controller/APIController.php
@@ -66,6 +66,8 @@ class APIController extends OCSController {
* @return DataResponse
*/
public function generateNotification($userId, $shortMessage, $longMessage) {
+ $shortMessage = (string) $shortMessage;
+ $longMessage = (string) $longMessage;
$user = $this->userManager->get($userId);
diff --git a/tests/Controller/APIControllerTest.php b/tests/Controller/APIControllerTest.php
index 2dbf726..1191803 100644
--- a/tests/Controller/APIControllerTest.php
+++ b/tests/Controller/APIControllerTest.php
@@ -72,6 +72,7 @@ class APIControllerTest extends \Test\TestCase {
return [
['user', '', '', false, null, false, null, 123, null, Http::STATUS_NOT_FOUND],
['user', '', '', false, null, false, 'user', 123, null, Http::STATUS_BAD_REQUEST],
+ ['user', null, '', false, null, false, 'user', 123, null, Http::STATUS_BAD_REQUEST],
['user', str_repeat('a', 256), '', false, null, false, 'user', 123, null, Http::STATUS_BAD_REQUEST],
['user', 'short', '', true, false, false, 'user', 123, '7b', Http::STATUS_OK],
['user', 'short', str_repeat('a', 4001), false, null, false, 'user', 123, null, Http::STATUS_BAD_REQUEST],