Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'session' of github.com:dchill42/CodeIgniter into session

  • Loading branch information...
commit 5af440df0761e564bd201aa49066519646b6d4ad 2 parents 52bcffb + f0e2924
@dchill42 authored
Showing with 29 additions and 17 deletions.
  1. +23 −11 system/core/Loader.php
  2. +6 −6 system/libraries/Driver.php
View
34 system/core/Loader.php
@@ -9,7 +9,7 @@
* Licensed under the Open Software License version 3.0
*
* This source file is subject to the Open Software License (OSL 3.0) that is
- * bundled with this package in the files license.txt / license.rst. It is
+ * bundled with this package in the files license.txt / license.rst. It is
* also available through the world wide web at this URL:
* http://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to obtain it
@@ -136,7 +136,7 @@ class CI_Loader {
*/
public function __construct()
{
- $this->_ci_ob_level = ob_get_level();
+ $this->_ci_ob_level = ob_get_level();
$this->_ci_library_paths = array(APPPATH, BASEPATH);
$this->_ci_helper_paths = array(APPPATH, BASEPATH);
$this->_ci_model_paths = array(APPPATH);
@@ -953,16 +953,29 @@ protected function _ci_load_class($class, $params = NULL, $object_name = NULL)
// Establish subdirectories to try - if one was specified, just use that
$trysubs = array($subdir);
- if ($subdir == '')
+ if ($subdir === '')
{
// Also check subdirectories matching class name
+ // This allows us to find libraries in self-named subdirectories
+ // (like Drivers) and extensions for those in the main libraries dir
$dir = strtolower($class).'/';
$trysubs[] = ucfirst($dir);
- $trysubs[] = $dir;
+
+ // If we aren't case-insensitive, check lowercase too
+ if (DIRECTORY_SEPARATOR !== '\\')
+ {
+ $trysubs[] = $dir;
+ }
}
// We'll test for both lowercase and capitalized versions of the file name
- foreach (array(ucfirst($class), strtolower($class)) as $class)
+ $cases = array(ucfirst($class));
+ if (DIRECTORY_SEPARATOR !== '\\')
+ {
+ // Case-sensitive - try lowercase too
+ $cases[] = strtolower($class);
+ }
+ foreach ($cases as $class)
{
// Is this a class extension request?
foreach($trysubs as $dir)
@@ -995,8 +1008,8 @@ protected function _ci_load_class($class, $params = NULL, $object_name = NULL)
// Does this look like a driver?
$driversub = strtolower($class).'/';
- if ((strtolower($dir) == $driversub || strtolower($basesub) == $driversub)
- && ! class_exists('CI_Driver_Library'))
+ if ((strtolower($dir) === $driversub OR strtolower($basesub) === $driversub)
+ && ! class_exists('CI_Driver_Library'))
{
// We aren't instantiating an object here, just making the base class available
require BASEPATH.'libraries/Driver.php';
@@ -1013,8 +1026,7 @@ protected function _ci_load_class($class, $params = NULL, $object_name = NULL)
$CI =& get_instance();
if ( ! isset($CI->$object_name))
{
- return $this->_ci_init_class($class, config_item('subclass_prefix'), $params,
- $object_name);
+ return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);
}
}
@@ -1046,7 +1058,7 @@ protected function _ci_load_class($class, $params = NULL, $object_name = NULL)
}
// Does this look like a driver?
- if (strtolower($dir) == strtolower($class).'/' && ! class_exists('CI_Driver_Library'))
+ if (strtolower($dir) === strtolower($class).'/' && ! class_exists('CI_Driver_Library'))
{
// We aren't instantiating an object here, just making the base class available
require BASEPATH.'libraries/Driver.php';
@@ -1351,4 +1363,4 @@ protected function _ci_prep_filename($filename, $extension)
}
/* End of file Loader.php */
-/* Location: ./system/core/Loader.php */
+/* Location: ./system/core/Loader.php */
View
12 system/libraries/Driver.php
@@ -9,7 +9,7 @@
* Licensed under the Open Software License version 3.0
*
* This source file is subject to the Open Software License (OSL 3.0) that is
- * bundled with this package in the files license.txt / license.rst. It is
+ * bundled with this package in the files license.txt / license.rst. It is
* also available through the world wide web at this URL:
* http://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to obtain it
@@ -67,8 +67,8 @@ class CI_Driver_Library {
* The first time a child is used it won't exist, so we instantiate it
* subsequents calls will go straight to the proper child.
*
- * @param string Child class name
- * @return object Child class
+ * @param string Child class name
+ * @return object Child class
*/
public function __get($child)
{
@@ -81,8 +81,8 @@ public function __get($child)
*
* Separate load_driver call to support explicit driver load by library or user
*
- * @param string Driver name (w/o parent prefix)
- * @return object Child class
+ * @param string Driver name (w/o parent prefix)
+ * @return object Child class
*/
public function load_driver($child)
{
@@ -92,7 +92,7 @@ public function load_driver($child)
if ( ! isset($this->lib_name))
{
// Get library name without any prefix
- $this->subclass_prefix = (string)$CI->config->item('subclass_prefix');
+ $this->subclass_prefix = (string) $CI->config->item('subclass_prefix');
$this->lib_name = str_replace(array('CI_', $this->subclass_prefix), '', get_class($this));
}
Please sign in to comment.
Something went wrong with that request. Please try again.