From 99f41ee353215dfc32d3126e10508b3fc0d08e57 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 23 Aug 2024 08:26:35 +0900 Subject: [PATCH] fix: TypeError when there is numeric field name TypeError: str_contains(): Argument #1 ($haystack) must be of type string, int given --- system/Validation/Validation.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system/Validation/Validation.php b/system/Validation/Validation.php index bfc661c2b3d4..c183a5bb739b 100644 --- a/system/Validation/Validation.php +++ b/system/Validation/Validation.php @@ -163,6 +163,9 @@ public function run(?array $data = null, ?string $group = null, $dbGroup = null) // Run through each rule. If we have any field set for // this rule, then we need to run them through! foreach ($this->rules as $field => $setup) { + // An array key might be int. + $field = (string) $field; + $rules = $setup['rules']; if (is_string($rules)) {