Restler
Restler copied to clipboard
Validation check causes parameter with value 0 to be set to NULL
https://github.com/Luracast/Restler/blob/06f0cadc14a5e47d52c431abb6f60197e7c0b2e2/vendor/Luracast/Restler/Data/Validator.php#L500
I've patched a check for 0 onto the end in my code, you may prefer something else:
if (!$info->required && empty($input) && $input !== 0) {
//optional parameter with a empty value assume null
return null;
}
The use case that triggered this was a property with a custom validator that has a default of 0 (its a default pagination offset)
This is fixed in Restler 5 currently in the v5 branch which will soon be pushed to master