AltoRouter icon indicating copy to clipboard operation
AltoRouter copied to clipboard

Optional variable not working as expected/it did previously

Open geckoeffect opened this issue 8 years ago • 4 comments

This route used to work in a previous version /client/[a:Action]?/[:ID]?/[**:trailing]? Accessing the route without an action where if Action wasn't defined it would still find the route eg http://altorouter.com/client now it only works if you have an action http://altorouter.com/client/list

Adding a / on line 210 so it does a strpos of '[' fixes this issue 210: } elseif (($position = strpos($route, '/[')) === false) {

geckoeffect avatar Jun 21 '17 23:06 geckoeffect

Try to use the http://altorouter.com/client/ route. Notice the trailing slash.

YannickFricke avatar Jun 22 '17 10:06 YannickFricke

I tired that too, it didn't work... but both work with my suggested code

geckoeffect avatar Jun 23 '17 14:06 geckoeffect

@geckoeffect Could you post your routes?

YannickFricke avatar Jun 23 '17 20:06 YannickFricke

That's interesting. Can you create a PR and then add a test for this behavior?

koenpunt avatar Jun 25 '17 09:06 koenpunt