pdscopes / php-form-validator

Simple, extendable form validator for multi-dimensional forms
MIT License
12 stars 3 forks source link

Exception thrown using min-arr-count if not countable #4

Closed pdscopes closed 4 years ago

pdscopes commented 4 years ago

Code needs to check if $value is countable before performing the count attempt on line 584:

https://github.com/pdscopes/php-form-validator/blob/df32248daff730c779b9c5c93fa49595b4cb34c4/src/Validate.php#L584

Error message:

Message: count(): Parameter must be an array or an object that implements Countable
File: /path/to/project/vendor/madesimple/php-form-validator/src/Validate.php
Line: 584
Trace: #0 [internal function]: PHPUnit_Util_ErrorHandler::handleError(2, 'count(): Parame...', '/path/to/project...', 584, Array)
#1 /path/to/project/api/vendor/madesimple/php-form-validator/src/Validate.php(584): count('')
#2 [internal function]: MadeSimple\Validator\Validate::minArrCount(Object(MadeSimple\Validator\Validator), Array, 'agents', 'min-arr-count', Array)
pdscopes commented 4 years ago

Fixed by fe1a79cf3f152acfb32f42620f7c15aedf122071 and 6cee6bb3d1867f22bf94cb6e90879e08e70dde6c.