Required constraint sometimes lets undefined fields through
VictorWesterlund opened this issue · 0 comments
VictorWesterlund commented
With the following Ruleset:
Ruleset->POST([
(new Rules("id"))
->required()
->type(Type::STRING),
(new Rules("user"))
->required()
->type(Type::STRING)
->max(128),
(new Rules("active"))
->required()
->type(Type::BOOLEAN),
(new Rules("expires"))
->required()
->type(Type::NUMBER)
->max(PHP_INT_MAX)
]);
Sending the following data with Reflect PHP Client syntax:
Client->call("endpoint", Method::PUT, [
"active" => true
]);
Will still let the request through to main()
despite a lot of required()
rules missing. The missing rules have their $_POST values set to null, so it does at least initialize processing on them.