Skip to content

Commit e73a8f6

Browse files
committed
1 parent 9f89973 commit e73a8f6

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Validation.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,8 @@ protected function parseRule(string $rule): array
529529
$exp = explode(':', $rule, 2);
530530
$rulename = $exp[0];
531531
if ($rulename !== 'regex') {
532-
$params = isset($exp[1])? explode(',', $exp[1]) : [];
532+
$params = isset($exp[1]) ?
533+
str_replace("\,", ",", preg_split('~(?<!\\\)' . preg_quote(",", '~') . '~', $exp[1])) : [];
533534
} else {
534535
$params = [$exp[1]];
535536
}

tests/ValidationTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ public function parseRuleProvider()
6868
['/^([a-zA-Z\,]*)$/'],
6969
],
7070
],
71+
[
72+
"in:a,b\,c,d\,e",
73+
[
74+
'in',
75+
['a','b,c','d,e']
76+
]
77+
]
7178
];
7279
}
7380
}

0 commit comments

Comments
 (0)