Skip to content

Commit 1ca24da

Browse files
committed
fix: if_exist does not work with array data
1 parent 33477f8 commit 1ca24da

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

system/Validation/FormatRules.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ class FormatRules
2929
*/
3030
public function alpha($str = null): bool
3131
{
32+
if (is_array($str)) {
33+
return false;
34+
}
35+
3236
if (! is_string($str)) {
3337
$str = (string) $str;
3438
}

system/Validation/Validation.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,10 @@ private function processIfExist(string $field, array $rules, array $data)
399399
break;
400400
}
401401
}
402-
} else {
402+
} elseif (str_contains($field, '.')) {
403403
$dataIsExisting = array_key_exists($ifExistField, $flattenedData);
404+
} else {
405+
$dataIsExisting = array_key_exists($ifExistField, $data);
404406
}
405407

406408
if (! $dataIsExisting) {

0 commit comments

Comments
 (0)