Skip to content
Snippets Groups Projects
Commit e9e8290a authored by Quentin Ribac's avatar Quentin Ribac
Browse files

FEAT #18091 TIME 0:55 added isset() checks on array entries

parent 289dc67e
No related branches found
No related tags found
No related merge requests found
......@@ -479,11 +479,11 @@ class UserController
return $response->withStatus(400)->withJson(['errors' => 'Body writingColor is empty or not a string']);
} elseif (!Validator::arrayType()->notEmpty()->validate($body['notifications'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body notifications is empty or not an array']);
} elseif (!Validator::boolType()->validate($body['notifications']['instant'])) {
} elseif (!isset($body['notifications']['instant']) || !Validator::boolType()->validate($body['notifications']['instant'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body notifications.instant is not a boolean']);
} elseif (!Validator::arrayType()->each(Validator::in($notificationsIds))->validate($body['notifications']['summaries'])) {
} elseif (!isset($body['notifications']['summaries']) || !Validator::arrayType()->each(Validator::in($notificationsIds))->validate($body['notifications']['summaries'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body notifications.summaries is not an array or contains invalid IDs']);
} elseif (!Validator::oneOf(Validator::falseVal(), Validator::intVal()->between(10, 50))->validate($body['signatureScaling'])) {
} elseif (!isset($body['signatureScaling']) || !Validator::oneOf(Validator::falseVal(), Validator::intVal()->between(10, 50))->validate($body['signatureScaling'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body signatureScaling is neither false nor an integer between 10 and 50']);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment