summaryrefslogtreecommitdiffstats
path: root/system/codeigniter
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/codeigniter
parentde8f409e84c4b2c428cba3f2845f2658d3db9b90 (diff)
PHP 5.3.0 compatibility changes
Diffstat (limited to 'system/codeigniter')
-rw-r--r--system/codeigniter/CodeIgniter.php6
-rw-r--r--system/codeigniter/Common.php24
2 files changed, 24 insertions, 6 deletions
diff --git a/system/codeigniter/CodeIgniter.php b/system/codeigniter/CodeIgniter.php
index 68f6c759e..b78736a04 100644
--- a/system/codeigniter/CodeIgniter.php
+++ b/system/codeigniter/CodeIgniter.php
@@ -56,8 +56,8 @@ require(APPPATH.'config/constants'.EXT);
* Define a custom error handler so we can log PHP errors
* ------------------------------------------------------
*/
-set_error_handler('_exception_handler');
-set_magic_quotes_runtime(0); // Kill magic quotes
+//set_error_handler('_exception_handler');
+@set_magic_quotes_runtime(0); // Kill magic quotes
/*
* ------------------------------------------------------
@@ -130,7 +130,7 @@ $LANG =& load_class('Language');
* Note: The Loader class needs to be included first
*
*/
-if (floor(phpversion()) < 5)
+if ( ! is_php(5))
{
load_class('Loader', FALSE);
require(BASEPATH.'codeigniter/Base4'.EXT);
diff --git a/system/codeigniter/Common.php b/system/codeigniter/Common.php
index f45c85c26..1ffed6a0c 100644
--- a/system/codeigniter/Common.php
+++ b/system/codeigniter/Common.php
@@ -150,17 +150,35 @@ function &load_class($class, $instantiate = TRUE)
if ($is_subclass == TRUE)
{
$name = config_item('subclass_prefix').$class;
- $objects[$class] =& new $name();
+
+ $objects[$class] =& instantiate_class(new $name());
return $objects[$class];
}
$name = ($class != 'Controller') ? 'CI_'.$class : $class;
-
- $objects[$class] =& new $name();
+
+ $objects[$class] =& instantiate_class(new $name());
return $objects[$class];
}
/**
+ * Instantiate Class
+ *
+ * Returns a new class object by reference, used by load_class() and the DB class.
+ * Required to retain PHP 4 compatibility and also not make PHP 5.3 cry.
+ *
+ * Use: $obj =& instantiate_class(new Foo());
+ *
+ * @access public
+ * @param object
+ * @return object
+ */
+function &instantiate_class(&$class_object)
+{
+ return $class_object;
+}
+
+/**
* Loads the main config.php file
*
* @access private