Skip to content

Commit 156e45b

Browse files
committed
fix: rule differs and matches with dot array
1 parent ab82f41 commit 156e45b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

system/Validation/StrictRules/Rules.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ public function differs(
4848
return $str !== dot_array_search($otherField, $data);
4949
}
5050

51-
if (! array_key_exists($field, $data)) {
51+
if (! array_key_exists($otherField, $data)) {
5252
return false;
5353
}
5454

55-
if (! array_key_exists($otherField, $data)) {
55+
if (str_contains($field, '.')) {
56+
if (! ArrayHelper::dotKeyExists($field, $data)) {
57+
return false;
58+
}
59+
} elseif (! array_key_exists($field, $data)) {
5660
return false;
5761
}
5862

@@ -281,11 +285,15 @@ public function matches(
281285
return $str === dot_array_search($otherField, $data);
282286
}
283287

284-
if (! array_key_exists($field, $data)) {
288+
if (! array_key_exists($otherField, $data)) {
285289
return false;
286290
}
287291

288-
if (! array_key_exists($otherField, $data)) {
292+
if (str_contains($field, '.')) {
293+
if (! ArrayHelper::dotKeyExists($field, $data)) {
294+
return false;
295+
}
296+
} elseif (! array_key_exists($field, $data)) {
289297
return false;
290298
}
291299

0 commit comments

Comments
 (0)