Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Fixed error with the Str::startsWith method throwing an exception w…
Browse files Browse the repository at this point in the history
…hen haystack is an array
  • Loading branch information
Rico Nijeboer committed Aug 24, 2021
1 parent 6d0e9a5 commit 4e34a9b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes will be documented here.

## v2.3.3 - 2021-08-24

**Bugfixes**

- Fixed error with the `Str::startsWith` method throwing an exception when haystack is an array

## v2.3.2 - 2021-08-24

**Bugfixes**
Expand Down
8 changes: 6 additions & 2 deletions src/Support/RuleHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,12 @@ public static function max(array $rules)
$val = (static::isArray($rules) || static::isString($rules)) ? 'intval' : 'floatval';

foreach ($rules as $rule) {
if (Str::startsWith($rule, 'max:')) {
return $val(explode(':', $rule, 2)[1]);
$ruleArray = Arr::wrap($rule);

foreach ($ruleArray as $ruleItem) {
if (Str::startsWith($ruleItem, 'max:')) {
return $valFunc(explode(':', $ruleItem, 2)[1]);
}
}
}

Expand Down

0 comments on commit 4e34a9b

Please sign in to comment.