diff options
-rw-r--r-- | system/core/Controller.php | 1 | ||||
-rw-r--r-- | system/core/Loader.php | 25 | ||||
-rw-r--r-- | system/libraries/Form_validation.php | 11 | ||||
-rw-r--r-- | system/libraries/Log.php | 2 | ||||
-rw-r--r-- | tests/codeigniter/core/Loader_test.php | 2 | ||||
-rw-r--r-- | tests/mocks/ci_testcase.php | 2 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 5 | ||||
-rw-r--r-- | user_guide_src/source/libraries/form_validation.rst | 3 |
8 files changed, 32 insertions, 19 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)) diff --git a/tests/codeigniter/core/Loader_test.php b/tests/codeigniter/core/Loader_test.php index be223f97d..ecc5ca933 100644 --- a/tests/codeigniter/core/Loader_test.php +++ b/tests/codeigniter/core/Loader_test.php @@ -493,7 +493,7 @@ class Loader_test extends CI_TestCase { ); $this->ci_vfs_create('autoload', '<?php $autoload = '.var_export($cfg, TRUE).';', $this->ci_app_root, 'config'); - $this->load->__construct(); + $this->load->initialize(); // Verify path $this->assertContains($path, $this->load->get_package_paths()); diff --git a/tests/mocks/ci_testcase.php b/tests/mocks/ci_testcase.php index 2d0a26830..f16492945 100644 --- a/tests/mocks/ci_testcase.php +++ b/tests/mocks/ci_testcase.php @@ -39,8 +39,6 @@ class CI_TestCase extends PHPUnit_Framework_TestCase { $this->ci_app_root = vfsStream::newDirectory('application')->at($this->ci_vfs_root); $this->ci_base_root = vfsStream::newDirectory('system')->at($this->ci_vfs_root); $this->ci_view_root = vfsStream::newDirectory('views')->at($this->ci_app_root); - vfsStream::newDirectory('config')->at($this->ci_app_root); - $this->ci_vfs_clone('application/config/autoload.php'); if (method_exists($this, 'set_up')) { diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index a7ff0d2bb..cbc6295c8 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -182,7 +182,7 @@ Release Date: Not Released - Added method ``remove()`` to remove a cart item, updating with quantity of 0 seemed like a hack but has remained to retain compatibility. - Added method ``get_item()`` to enable retrieving data for a single cart item. - :doc:`Image Manipulation library <libraries/image_lib>` changes include: - - The initialize() method now only sets existing class properties. + - The ``initialize()`` method now only sets existing class properties. - Added support for 3-length hex color values for *wm_font_color* and *wm_shadow_color* properties, as well as validation for them. - Class properties *wm_font_color*, *wm_shadow_color* and *wm_use_drop_shadow* are now protected, to avoid breaking the ``text_watermark()`` method if they are set manually after initialization. - If property *maintain_ratio* is set to TRUE, ``image_reproportion()`` now doesn't need both width and height to be specified. @@ -245,7 +245,6 @@ Release Date: Not Released - ``library()`` method will now load drivers as well, for backward compatibility of converted libraries (like :doc:`Session <libraries/sessions>`). - ``$config['rewrite_short_tags']`` now has no effect when using PHP 5.4 as ``<?=`` will always be available. - Changed method ``config()`` to return whatever ``CI_Config::load()`` returns instead of always being void. - - Removed method ``initialize()`` and moved its logic to the constructor. - :doc:`Input Library <libraries/input>` changes include: - Added ``method()`` to retrieve ``$_SERVER['REQUEST_METHOD']``. - Added support for arrays and network addresses (e.g. 192.168.1.1/24) for use with the *proxy_ips* setting. @@ -413,7 +412,7 @@ Bug fixes for 3.0 - Fixed a bug (#1938) - :doc:`Email Library <libraries/email>` removed multiple spaces inside a pre-formatted plain text message. - Fixed a bug (#388, #705) - :doc:`URI Library <libraries/uri>` didn't apply URL-decoding to URI segments that it got from **REQUEST_URI** and/or **QUERY_STRING**. - Fixed a bug (#122) - :doc:`URI Library <libraries/uri>` method ``ruri_string()`` didn't include a directory if one is used. -- Fixed a bug - :doc:`Routing Library <general/routing>` didn't properly handle *404_override* in a subdirectory when a method is also specified. +- Fixed a bug - :doc:`Routing Library <general/routing>` didn't properly handle *default_controller* in a subdirectory when a method is also specified. - Fixed a bug (#953) - :doc:`post_controller_constructor hook <general/hooks>` wasn't called with a *404_override*. Version 2.1.3 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 ****************** |