bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.27k stars 7.6k forks source link

MX URI routing broken due to #a439905 #3110

Closed hArpanet closed 10 years ago

hArpanet commented 10 years ago

I'm beginning to put together a site using CI3.0-dev and have implemented Bigwebmaster's Modular Extensions on top of it. (https://github.com/Bigwebmaster/codeigniter-modular-extensions-hmvc)

Following through the installation steps, I created modules/welcome and moved Welcome.php from /application/controllers/Welcome.php to /application/modules/welcome/controllers/Welcome.php

With the 'fix' implemented by commit https://github.com/EllisLab/CodeIgniter/commit/a4399051455f844f432ac453fb9c3202c4464cf2 this creates...

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 0

Filename: core/Router.php

Line Number: 255

Backtrace:

File: /srv/www/htdocs/new-site/application/third_party/MX/Router.php
Line: 200
Function: _set_request

File: /srv/www/htdocs/new-site/index.php
Line: 274
Function: require_once

Removing the changes made by https://github.com/EllisLab/CodeIgniter/commit/a4399051455f844f432ac453fb9c3202c4464cf2 allows it to run again without error.

ivantcholakov commented 10 years ago

Not so fast. I doubt you are fixing anything :-) You see the welcome page which is routed by default. But when you make another module are you able to see its index page?

The last known by me version of MX is 5.4, it is compatible with CI 2.x only. Adaptation for CI 3 is possible, but it requires more work than you show here.

narfbg commented 10 years ago

Report this to the MX developer, not CI.

hArpanet commented 10 years ago

@narfbg I've dug about a bit more and can see now that /system/core/Router.php -> _parse_routes()

As such the segments array in v3 will always be passed as [0] based (preventing the error I was getting) regardless of https://github.com/EllisLab/CodeIgniter/commit/a4399051455f844f432ac453fb9c3202c4464cf2 shifting them into element [1].

@ivantcholakov I did fix something, because it made it work, but it wasn't the correct fix for the real problem :-)

Thanks for your help in tracking this down guys.

_PS. Before wiredesignz starts yelling at me, I've also edited the original comment to be more specific as this issue is not present in the original MX version (as _parseroutes() is not overloaded).

narfbg commented 10 years ago

It's still an MX problem and not a CI one, it doesn't matter what you're digging.