bug: Modular Extensions – HMVC with CI 2.0

February 12th, 2011

There is a bug in a /MX/Router.php witch produce redirect to 404 page when default_controller not found in /controllers folder.
Variable $config[‘uri_protocol’] is set to “AUTO” or to “REQUEST_URI”, otherwise it working fine.
That has something to do with new URL protocol auto detection.

How to reproduce:
1. clean CI (from bitbucket)
2. HMVC (https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc)
3. move /controllers/welcome.php to /modules/welcome/controllers/
4. move /views/welcome_message.php to same modules folder /modules/welcome/…

Call: http://your_url.dev (you’ll get 404)
But if you call: http://your_url.dev/index.php/welcome everything will be fine.

my correction…
/third_party/MX/Router.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public function _validate_request($segments) {
 
        /*  correction */
        if (count($segments) == 0)
        {
            return $segments;
        }
        /*  end correction */
 
 
        /* locate module controller */
        if ($located = $this->locate($segments)) return $located;
 
        /* use a default 404_override controller */
        if (isset($this->routes['404_override']) AND $segments = explode('/', $this->routes['404_override'])) {
            if ($located = $this->locate($segments)) return $located;
        }
 
        /* no controller found */
        show_404();
    }

Comments are closed.