summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/core/Controller.php1
-rw-r--r--system/core/Loader.php25
-rw-r--r--system/libraries/Form_validation.php11
-rw-r--r--system/libraries/Log.php2
4 files changed, 29 insertions, 10 deletions
diff --git a/system/core/Controller.php b/system/core/Controller.php
index cbdf0515f..ee6fec8d5 100644
--- a/system/core/Controller.php
+++ b/system/core/Controller.php
@@ -65,6 +65,7 @@ class CI_Controller {
}
$this->load =& load_class('Loader', 'core');
+ $this->load->initialize();
log_message('debug', 'Controller Class Initialized');
}
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 2a78f4153..88fbdb6e1 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -130,10 +130,8 @@ class CI_Loader {
/**
* Class constructor
*
- * Sets component load paths, gets the initial output buffering level
- * and calls the autoloader.
+ * Sets component load paths, gets the initial output buffering level.
*
- * @uses CI_Loader::_ci_autoloader()
* @return void
*/
public function __construct()
@@ -143,8 +141,6 @@ class CI_Loader {
$this->_ci_helper_paths = array(APPPATH, BASEPATH);
$this->_ci_model_paths = array(APPPATH);
$this->_ci_view_paths = array(VIEWPATH => TRUE);
- $this->_base_classes =& is_loaded();
- $this->_ci_autoloader();
log_message('debug', 'Loader Class Initialized');
}
@@ -152,6 +148,23 @@ class CI_Loader {
// --------------------------------------------------------------------
/**
+ * Initializer
+ *
+ * @todo Figure out a way to move this to the constructor
+ * without breaking *package_path*() methods.
+ * @uses CI_Loader::_ci_autoloader()
+ * @used-by CI_Controller::__construct()
+ * @return void
+ */
+ public function initialize()
+ {
+ $this->_base_classes =& is_loaded();
+ $this->_ci_autoloader();
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Is Loaded
*
* A utility method to test if a class is in the self::$_ci_classes array.
@@ -1134,7 +1147,7 @@ class CI_Loader {
*
* Loads component listed in the config/autoload.php file.
*
- * @used-by CI_Loader::__construct()
+ * @used-by CI_Loader::initialize()
* @return void
*/
protected function _ci_autoloader()
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/system/libraries/Log.php b/system/libraries/Log.php
index a4dd47f86..e66270840 100644
--- a/system/libraries/Log.php
+++ b/system/libraries/Log.php
@@ -152,7 +152,7 @@ class CI_Log {
if ( ! file_exists($filepath))
{
$newfile = TRUE;
- $message .= '<'."?php if defined('BASEPATH') OR exit('No direct script access allowed'); ?".">\n\n";
+ $message .= '<'."?php defined('BASEPATH') OR exit('No direct script access allowed'); ?".">\n\n";
}
if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE))