diff options
author | Joas Schilling <coding@schilljs.com> | 2020-06-18 10:41:46 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-06-29 16:50:20 +0300 |
commit | 8e900c3ef820b1665a51b7a1e4d9a985413e3f3c (patch) | |
tree | aa918cb8aa4da960844c418dd4db5266927f6d3e /lib/Service/RoomService.php | |
parent | 9432b91b281416f15c626750ac1ba2d1033d49ff (diff) |
Also throw on invalid object data
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Service/RoomService.php')
-rw-r--r-- | lib/Service/RoomService.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Service/RoomService.php b/lib/Service/RoomService.php index 2960cbaed..cee119c8e 100644 --- a/lib/Service/RoomService.php +++ b/lib/Service/RoomService.php @@ -91,6 +91,21 @@ class RoomService { throw new InvalidArgumentException('type'); } + $objectType = trim($objectType); + if (isset($objectType[64])) { + throw new InvalidArgumentException('object_type'); + } + + $objectId = trim($objectId); + if (isset($objectId[64])) { + throw new InvalidArgumentException('object_id'); + } + + if (($objectType !== '' && $objectId === '') || + ($objectType === '' && $objectId !== '')) { + throw new InvalidArgumentException('object'); + } + $room = $this->manager->createRoom($type, $name, $objectType, $objectId); if ($owner instanceof IUser) { |