Я недавно обновил свой проект до CI4, а также обновил свой WAMP до последней версии.
Но с тех пор мой проект не работал. Существует класс MY_Controller
, который унаследован от CI_Controller
, помещенного в application/core/
. Это дает мне такую ошибку:
An uncaught Exception was encountered
Type: Error
Message: The "Generator" class is reserved for internal use and cannot be manually instantiated
Filename: C:\wamp64\www\alnoor\system\core\Loader.php
Line Number: 1285
Backtrace:
File: C:\wamp64\www\alnoor\application\core\MY_Controller.php
Line: 7
Function: __construct
File: C:\wamp64\www\alnoor\index.php
Line: 315
Function: require_once
Кто-нибудь знает, что это значит или как я могу его получить исправлено?
Это функция класса Loader:
protected function _ci_init_library($class, $prefix, $config = FALSE, $object_name = NULL)
{
// Is there an associated config file for this class? Note: these should always be lowercase
if ($config === NULL)
{
// Fetch the config paths containing any package paths
$config_component = $this->_ci_get_component('config');
if (is_array($config_component->_config_paths))
{
$found = FALSE;
foreach ($config_component->_config_paths as $path)
{
// We test for both uppercase and lowercase, for servers that
// are case-sensitive with regard to file names. Load global first,
// override with environment next
if (file_exists($path.'config/'.strtolower($class).'.php'))
{
include($path.'config/'.strtolower($class).'.php');
$found = TRUE;
}
elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php'))
{
include($path.'config/'.ucfirst(strtolower($class)).'.php');
$found = TRUE;
}
if (file_exists($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'))
{
include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php');
$found = TRUE;
}
elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
{
include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php');
$found = TRUE;
}
// Break on the first found configuration, thus package
// files are not overridden by default paths
if ($found === TRUE)
{
break;
}
}
}
}
$class_name = $prefix.$class;
// Is the class name valid?
if ( ! class_exists($class_name, FALSE))
{
log_message('error', 'Non-existent class: '.$class_name);
show_error('Non-existent class: '.$class_name);
}
// Set the variable name we will assign the class to
// Was a custom class name supplied? If so we'll use it
if (empty($object_name))
{
$object_name = strtolower($class);
if (isset($this->_ci_varmap[$object_name]))
{
$object_name = $this->_ci_varmap[$object_name];
}
}
// Don't overwrite existing properties
$CI =& get_instance();
if (isset($CI->$object_name))
{
if ($CI->$object_name instanceof $class_name)
{
log_message('debug', $class_name." has already been instantiated as '".$object_name."'. Second attempt aborted.");
return;
}
show_error("Resource '".$object_name."' already exists and is not a ".$class_name." instance.");
}
// Save the class name and object name
$this->_ci_classes[$object_name] = $class;
// Instantiate the class
$CI->$object_name = isset($config)
? new $class_name($config)
: new $class_name();
}
Ошибка в последнем утверждении.