mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-31 07:01:54 +00:00
avoids php blowing up if an array value is passed
if incoming data has an array value set with a slug rule on it, you get preg_match() expects parameter 2 to be string, array given vendor\vlucas\valitron\src\Valitron\Validator.php:571
This commit is contained in:
parent
15171779b3
commit
c729a0c4ac
@ -565,6 +565,9 @@ class Validator
|
|||||||
*/
|
*/
|
||||||
protected function validateSlug($field, $value)
|
protected function validateSlug($field, $value)
|
||||||
{
|
{
|
||||||
|
if(is_array($value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return preg_match('/^([-a-z0-9_-])+$/i', $value);
|
return preg_match('/^([-a-z0-9_-])+$/i', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user