diff options
author | Joas Schilling <coding@schilljs.com> | 2017-03-25 15:06:50 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-03-25 15:06:50 +0300 |
commit | 1bbfc14baab7afb17321c5bc5d381538ed141c25 (patch) | |
tree | ace99e22b6b354688d4415d6c901b01cabcd1e54 | |
parent | 1d3adbdb54b036d2dc6afab021cfd311ffc9cdad (diff) |
Make sure the parameters are always a string
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/Controller/APIController.php | 2 | ||||
-rw-r--r-- | tests/Controller/APIControllerTest.php | 1 |
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], |