-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Currently, the Size rule assumes it will receive a string or number (int/float). This is problematic when validating request data that often comes in as string values. Intuitively, if the size rule is combined with numeric, then the value should be sanitized first as a number before validating.
Workaround by extending the Rule locally and adding sanitize based on value
public function sanitize($value)
{
if (is_numeric($value)) {
if (strpos($value, '.') !== false) {
return (float)$value;
}
return (int)$value;
}
return $value;
}
Proposed solution
Instead of sanitizing based on value, check if numeric or other number related rule is being used as well.
Metadata
Metadata
Assignees
Labels
No labels