summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-11-03 17:09:01 +0100
committerAndrey Andreev <narf@bofh.bg>2012-11-03 17:09:01 +0100
commitcdac248e9cf7a8ea3ed426f189bb52254800bc2a (patch)
tree9a3c9cbb5fe2761c2c9469c861b95414eb9e3151
parent28daadeca8ebc889fd799ed8bb58293ebeb4fabd (diff)
It appears to break get_instance()->*_package_path*() usage which is very common. Need to figure out how to resolve this.
-rw-r--r--system/core/Controller.php1
-rw-r--r--system/core/Loader.php25
-rw-r--r--tests/codeigniter/core/Loader_test.php2
-rw-r--r--tests/mocks/ci_testcase.php2
-rw-r--r--user_guide_src/source/changelog.rst3
5 files changed, 22 insertions, 11 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/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 abb75f579..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.