summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-11-03 17:26:27 +0100
committerAndrey Andreev <narf@bofh.bg>2012-11-03 17:26:27 +0100
commit751f2479460c6f5cfc5333f6561d9827a92089bd (patch)
tree7714203244d3532a0e2578df811697a3bc8c2f27
parentd7677ab78cb98283677f85a8acf3ef4489a30d5e (diff)
Fix #1957
-rw-r--r--system/libraries/Form_validation.php11
-rw-r--r--user_guide_src/source/libraries/form_validation.rst3
2 files changed, 8 insertions, 6 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 50708c7d8..e50eee4f2 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -440,11 +440,10 @@ class CI_Form_validation {
// Load the language file containing error messages
$this->CI->lang->load('form_validation');
- // Cycle through the rules for each field, match the
- // corresponding $_POST item and test for errors
+ // Cycle through the rules for each field and match the corresponding $validation_data item
foreach ($this->_field_data as $field => $row)
{
- // Fetch the data from the corresponding $_POST or validation array and cache it in the _field_data array.
+ // Fetch the data from the validation_data array item and cache it in the _field_data array.
// Depending on whether the field name is an array or a string will determine where we get it from.
if ($row['is_array'] === TRUE)
{
@@ -454,7 +453,13 @@ class CI_Form_validation {
{
$this->_field_data[$field]['postdata'] = $validation_array[$field];
}
+ }
+ // Execute validation rules
+ // Note: A second foreach (for now) is required in order to avoid false-positives
+ // for rules like 'matches', which correlate to other validation fields.
+ foreach ($this->_field_data as $field => $row)
+ {
// Don't try to validate if we have no rules set
if (empty($row['rules']))
{
diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst
index c010eb578..a3a35b499 100644
--- a/user_guide_src/source/libraries/form_validation.rst
+++ b/user_guide_src/source/libraries/form_validation.rst
@@ -910,9 +910,6 @@ Rule Parameter Description
to two parameters, where at least one is required (to pass
the field data).
-.. note:: When using the **matches** rule, the form item specified
- to compare against must already be defined.
-
******************
Prepping Reference
******************