summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2009-07-29 16:19:18 +0200
committerDerek Jones <derek.jones@ellislab.com>2009-07-29 16:19:18 +0200
commitf0a9b332445977cfb05fee2dacc02667946a9cd2 (patch)
tree740e6f0bca8932f75c60ba7aa35831783e567764 /system/libraries
parentde8f409e84c4b2c428cba3f2845f2658d3db9b90 (diff)
PHP 5.3.0 compatibility changes
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Loader.php2
-rw-r--r--system/libraries/Profiler.php4
-rw-r--r--system/libraries/URI.php4
3 files changed, 6 insertions, 4 deletions
diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php
index d615a1363..781c83c65 100644
--- a/system/libraries/Loader.php
+++ b/system/libraries/Loader.php
@@ -252,7 +252,7 @@ class CI_Loader {
require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_utility'.EXT);
$class = 'CI_DB_'.$CI->db->dbdriver.'_utility';
- $CI->dbutil =& new $class();
+ $CI->dbutil =& instantiate_class(new $class());
$CI->load->_ci_assign_to_models();
}
diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php
index 98cec0653..ecd0e708d 100644
--- a/system/libraries/Profiler.php
+++ b/system/libraries/Profiler.php
@@ -103,11 +103,11 @@ class CI_Profiler {
function _compile_queries()
{
$dbs = array();
-
+
// Let's determine which databases are currently connected to
foreach (get_object_vars($this->CI) as $CI_object)
{
- if ( is_subclass_of(get_class($CI_object), 'CI_DB') )
+ if (is_object($CI_object) && is_subclass_of(get_class($CI_object), 'CI_DB') )
{
$dbs[] = $CI_object;
}
diff --git a/system/libraries/URI.php b/system/libraries/URI.php
index efc7a18b3..68b678053 100644
--- a/system/libraries/URI.php
+++ b/system/libraries/URI.php
@@ -186,7 +186,9 @@ class CI_URI {
{
if ($str != '' && $this->config->item('permitted_uri_chars') != '' && $this->config->item('enable_query_strings') == FALSE)
{
- if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str))
+ // preg_quote() in PHP 5.3 escapes -, so the str_replace() and addition of - to preg_quote() is to maintain backwards
+ // compatibility as many are unaware of how characters in the permitted_uri_chars will be parsed as a regex pattern
+ if ( ! preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $str))
{
show_error('The URI you submitted has disallowed characters.', 400);
}