From f0a9b332445977cfb05fee2dacc02667946a9cd2 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Wed, 29 Jul 2009 14:19:18 +0000 Subject: PHP 5.3.0 compatibility changes --- system/codeigniter/Common.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'system/codeigniter/Common.php') 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,16 +150,34 @@ 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 * -- cgit v1.2.3-24-g4f1b