You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a (custom) router returns controller classes that have already been loaded, but perhaps from a different location/namespace, there's no way to make it work. This seems like a very silly limitation.
The code referenced above shouldn't even be loading the class from the filesystem, let alone constructing some file path out of a class name. At the very least, this whole default logic would only make sense after checking class_exists().
In short, here's some backward-compatible improved version:
if (empty($class))
{
$e404 = TRUE;
}
else
{
if (!class_exists($class) && file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php') ) {
require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php');
}
PS: class_exists triggers autoloading, in the right scenario, thus avoid the rest of the file-checking-file-loading code.
The text was updated successfully, but these errors were encountered:
CI is relatively flexible, there's just one tiny major problem:
https://github.com/bcit-ci/CodeIgniter/blob/63d037565dd782795021dcbd3b1ca6f8c8a509e4/system/core/CodeIgniter.php#L355...L361
If a (custom) router returns controller classes that have already been loaded, but perhaps from a different location/namespace, there's no way to make it work. This seems like a very silly limitation.
The code referenced above shouldn't even be loading the class from the filesystem, let alone constructing some file path out of a class name. At the very least, this whole default logic would only make sense after checking
class_exists()
.In short, here's some backward-compatible improved version:
PS:
class_exists
triggers autoloading, in the right scenario, thus avoid the rest of the file-checking-file-loading code.The text was updated successfully, but these errors were encountered: