Skip to content

Commit b73173b

Browse files
committed
Fix issue with single validation with single value
1 parent d8e0d22 commit b73173b

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

system/Validation/Validation.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,19 @@ public function run(array $data = null, string $group = null, string $db_group =
170170
$rules = $this->splitRules($rules);
171171
}
172172

173-
$value = dot_array_search($rField, $data);
173+
$value = dot_array_search($rField, $data);
174+
$fieldNameToken = explode('.', $rField);
174175

175-
if (! is_array($value))
176+
if (is_array($value) && end($fieldNameToken) === '*')
176177
{
177-
$value = [$value];
178+
foreach ($value as $val)
179+
{
180+
$this->processRules($rField, $rSetup['label'] ?? $rField, $val ?? null, $rules, $data);
181+
}
178182
}
179-
180-
foreach ($value as $val)
183+
else
181184
{
182-
$this->processRules($rField, $rSetup['label'] ?? $rField, $val ?? null, $rules, $data);
185+
$this->processRules($rField, $rSetup['label'] ?? $rField, $value ?? null, $rules, $data);
183186
}
184187
}
185188

0 commit comments

Comments
 (0)