Found a bug in HMVC’s Loader that leads to a “Fatal error: Maximum function nesting level of ‘100’ reached, aborting!”
The error can be reproduced by creating an autoload config file within a module and adding a library to load. Ex:
modules/
..admin/
....config/
......autoload.php
....libraries/
......admin_controller.php
The problem was that the ‘_autoloader’ function kept recursively trying to “autoload” the library regardless of whether or not it’s already loaded. This lead to an endless loop where the loaded file (which extends the MX_Controller) called it’s parent controller which in turn tried to ‘initialize’ on every call in which ‘_autoloader’ was called again and again (a recursive result of the infamous ‘goto’).
I solved this by adding a line in the Loader to check if the class was already loaded so it doesn’t recurse itself…
// MX/Loader.php
// line (396-398)?:
// -> replace:
// foreach ($autoload['libraries'] as $library) {
// $this->library($library);
// }
// -> to:
foreach ($autoload['libraries'] as $library) {
if (class_exists($library, FALSE)) continue;
$this->library($library);
}
~NS
