Skip to content

Commit

Permalink
added check field != matches[1] of {(\w+)\} if found
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed May 5, 2020
1 parent 25daa42 commit 9333dcc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions system/Validation/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ public function is_not_unique(string $str = null, string $field, array $data): b

if (! empty($where_field) && ! empty($where_value))
{
if (! preg_match('/\{(\w+)\}/', $where_value))
preg_match('/{(\w+)\}/', $where_value, $matches);
if (! $matches || $where_field !== $matches[1])
{
$row = $row->where($where_field, $where_value);
}
Expand Down Expand Up @@ -231,7 +232,8 @@ public function is_unique(string $str = null, string $field, array $data): bool

if (! empty($ignoreField) && ! empty($ignoreValue))
{
if (! preg_match('/\{(\w+)\}/', $ignoreValue))
preg_match('/{(\w+)\}/', $ignoreValue, $matches);
if (! $matches || $ignoreField !== $matches[1])
{
$row = $row->where("{$ignoreField} !=", $ignoreValue);
}
Expand Down

0 comments on commit 9333dcc

Please sign in to comment.