Welcome Guest, Not a member yet? Register   Sign In
HMVC (wiredesignz) bug - CI 2.0
#1

[eluser]crnalajna[/eluser]
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/codeig...sions-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
Code:
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();
    }
#2

[eluser]wiredesignz[/eluser]
Not all servers reproduce the same values for URI Protocol, this is why CI allows for a few different protocol methods.

Find a URI protocol that works for you, rather than altering code.
#3

[eluser]crnalajna[/eluser]
That part of code is just copied from original Router.php _validate_request function which working just fine w/o your lib, and with uri protocol set to auto.

btw I'm using xampp
#4

[eluser]wiredesignz[/eluser]
I have never been made aware of a problem like this before and I cannot reproduce your problem?

I cannot get any test application I have here to call the _validate_request() method with an empty $segments array.

Calling the domain by itself causes the method to be called with the default controller value.
#5

[eluser]crnalajna[/eluser]
I believe I didn't had problems with older CI (2.0) versions.
This happening with latest HMVC lib and CI from Bitbucket.

I would like to see is there somebody else who can confirm that.

wiredesignz, thank you for your time Smile
#6

[eluser]LeeNug[/eluser]
I can confirm this issue affects both my local machine (running MAMP) and a production server. Using a completely clean install of reactor (981178ef66b5) and modular extensions (ad0cf8bd6eb9).

Seems to work when I play around with the URI_protocol setting.
#7

[eluser]crnalajna[/eluser]
Hi,

Can you change-put /core/MY_Router.php and test how that work on both of your servers?

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

/* load the MX_Router class */
require APPPATH."third_party/MX/Router.php";

class MY_Router extends MX_Router {


    public function _validate_request($segments) {

        if (count($segments) == 0) return $segments;

        if ($located = $this->locate($segments)) return $located;

        if (isset($this->routes['404_override']) AND $segments = explode('/', $this->routes['404_override'])) {
            if ($located = $this->locate($segments)) return $located;
        }

        show_404();
    }

}

thanks
#8

[eluser]LeeNug[/eluser]
@crnalajna That seems to have corrected the issue for me, both locally and on a production server. Thank you Smile




Theme © iAndrew 2016 - Forum software by © MyBB