Call to a member function item() on null MX/Module

2019-08-21 08:42发布

问题:

I have trouble about ckeditor and kcfinder in codeigniter, i used HMVC from wiredesignz codeigniter-modular-extensions-hmvc, when i want to browse images error like this

Fatal error: Call to a member function item() on null in C:\xampp\htdocs\mypro\abbas_eterna\application\third_party\MX\Modules.php on line 8

A PHP Error was encountered

Severity: Error

Message: Call to a member function item() on null

Filename: MX/Modules.php

Line Number: 8

Backtrace:

When i do not use HMVC to access ckeditor and browse image from kcfinder is good, and when use HMVC is trouble. I already search reference in this stackoverflow and google but not same trouble with me. i already declare in application/config.php

    $config['modules_locations'] = array(
    APPPATH.'modules/' => '../modules/',
);

and configurasi file index in root folder

$system_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'system';
$application_folder = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'application';

and i use session that i setting in folder asset/kcfinder/conf/config.php

ob_start();
include('./../../index.php');
ob_end_clean();
$CI =& get_instance();
$CI->load->driver('session');
if(@$_SESSION['upload_image_file_manager'] == TRUE){
    $codeigniterAuth = false;
} else {
    $codeigniterAuth = true;
}

回答1:

<?php (defined('BASEPATH')) OR exit('No direct script access allowed');

(defined('EXT')) OR define('EXT', '.php');

global $CFG;

/* get module locations from config settings or use the default module location and offset */
is_array(Modules::$locations = $CFG->item('modules_locations')) OR Modules::$locations = array(
    APPPATH.'modules/' => '../modules/',
);

/* PHP5 spl_autoload */
spl_autoload_register('Modules::autoload');