summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-07 21:49:24 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-07 21:49:24 +0100
commit3b2c5083034675d88d9e516b5c5aca5119d6f918 (patch)
tree8bcd1f896edcf2f2cb2ca0010b4ee93adbaa163f
parent8e0ea9f64fa452c9ec04fc3f16bc571274ee1552 (diff)
Fix issue #501
-rw-r--r--system/libraries/Form_validation.php20
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 10 insertions, 11 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index cdb3d3d62..bd8b7c216 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -65,7 +65,7 @@ class CI_Form_validation {
mb_internal_encoding($this->CI->config->item('charset'));
}
- log_message('debug', "Form Validation Class Initialized");
+ log_message('debug', 'Form Validation Class Initialized');
}
// --------------------------------------------------------------------
@@ -84,7 +84,7 @@ class CI_Form_validation {
{
// No reason to set rules if we have no POST data
// or a validation array has not been specified
- if (count($_POST) === 0 && count($this->validation_data) === 0)
+ if ($this->CI->input->method() !== 'post' && empty($this->validation_data))
{
return $this;
}
@@ -165,9 +165,9 @@ class CI_Form_validation {
*
* If an array is set through this method, then this array will
* be used instead of the $_POST array
- *
- * Note that if you are validating multiple arrays, then the
- * reset_validation() function should be called after validating
+ *
+ * Note that if you are validating multiple arrays, then the
+ * reset_validation() function should be called after validating
* each array due to the limitations of CI's singleton
*
* @param array $data
@@ -1156,15 +1156,14 @@ class CI_Form_validation {
}
// --------------------------------------------------------------------
-
+
/**
* Equal to or Greater than
*
- * @access public
* @param string
* @return bool
*/
- function greater_than_equal_to($str, $min)
+ public function greater_than_equal_to($str, $min)
{
if ( ! is_numeric($str))
{
@@ -1195,11 +1194,10 @@ class CI_Form_validation {
/**
* Equal to or Less than
*
- * @access public
* @param string
* @return bool
*/
- function less_than_equal_to($str, $max)
+ public function less_than_equal_to($str, $max)
{
if ( ! is_numeric($str))
{
@@ -1351,7 +1349,7 @@ class CI_Form_validation {
* Prevents subsequent validation routines from being affected by the
* results of any previous validation routine due to the CI singleton.
*
- * @return void
+ * @return void
*/
public function reset_validation()
{
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 58a4cb76b..4c6fd38bc 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -147,6 +147,7 @@ Bug fixes for 3.0
- Fixed a bug in Oracle's DB_result class where the cursor id passed to it was always NULL.
- Fixed a bug (#64) - Regular expression in DB_active_rec.php failed to handle queries containing SQL bracket delimiters in the join condition.
- Fixed a bug in the :doc:`Session Library <libraries/sessions>` where a PHP E_NOTICE error was triggered by _unserialize() due to results from databases such as MSSQL and Oracle being space-padded on the right.
+- Fixed a bug (#501) - set_rules() to check if the request method is not 'POST' before aborting, instead of depending on count($_POST) in the :doc:`Form Validation Library <libraries/form_validation>`.
Version 2.1.1
=============