Welcome Guest, Not a member yet? Register   Sign In
Routing bug
#1

[eluser]Seppo[/eluser]
When setting up a rule that routes the uri "back" it doesn't reindex. For example
Code:
routes['welcome/index/abc'] = 'welcome/index';
it actually calls to welcome::index('abc'), but it should call welcome::index(); because the router erased the third segment. Also the rsegments array is wrong.

The error is on CI_URI::_reindex_segments
Code:
$diff = (count(array_diff($this->rsegments, $this->segments)) == 0) ? FALSE : TRUE;
I´m not sure how to fix it... May be comparing both arrays, in a simpler way ($this->rsegments == $this->segments) ? I´m not sure I´m not breaking anything doing that =)
#2

[eluser]xwero[/eluser]
If you need to route to the index function of a class you can use the controller without the index method
Code:
routes['welcome/index/abc'] = 'welcome';
#3

[eluser]Seppo[/eluser]
I put index as an example.
Code:
routes['welcome/index/abc'] = 'welcome/index';
routes['welcome/index/abc'] = 'welcome';  // also buged
routes['welcome/hello/abc'] = 'welcome/hello';  // also buged
rsegments are wrong always that the rsegments are contained on the segments




Theme © iAndrew 2016 - Forum software by © MyBB