From 5dacb15c7ccd93ecb74b99d9788397941dd642cb Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 31 Mar 2022 11:59:08 +0900 Subject: [PATCH] fix: remove session _ci_validation_errors before running validation --- system/Validation/Validation.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/system/Validation/Validation.php b/system/Validation/Validation.php index 155efc223492..f330c91799f6 100644 --- a/system/Validation/Validation.php +++ b/system/Validation/Validation.php @@ -108,6 +108,12 @@ public function __construct($config, RendererInterface $view) */ public function run(?array $data = null, ?string $group = null, ?string $dbGroup = null): bool { + // If there are still validation errors for redirect_with_input request, remove them. + // See `getErrors()` method. + if (isset($_SESSION, $_SESSION['_ci_validation_errors'])) { + unset($_SESSION['_ci_validation_errors']); + } + $data ??= $this->data; // i.e. is_unique