Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gdarko committed Jul 3, 2022
1 parent 9f89973 commit e73a8f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,8 @@ protected function parseRule(string $rule): array
$exp = explode(':', $rule, 2);
$rulename = $exp[0];
if ($rulename !== 'regex') {
$params = isset($exp[1])? explode(',', $exp[1]) : [];
$params = isset($exp[1]) ?
str_replace("\,", ",", preg_split('~(?<!\\\)' . preg_quote(",", '~') . '~', $exp[1])) : [];
} else {
$params = [$exp[1]];
}
Expand Down
7 changes: 7 additions & 0 deletions tests/ValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ public function parseRuleProvider()
['/^([a-zA-Z\,]*)$/'],
],
],
[
"in:a,b\,c,d\,e",
[
'in',
['a','b,c','d,e']
]
]
];
}
}

0 comments on commit e73a8f6

Please sign in to comment.