Respect/Rest

Need to fix build error on master.

nickl- opened this issue · 3 comments

A unit test is failing after merging the last PRs.

Fatal error: Uncaught ArgumentCountError: Too few arguments to function Respect\Rest\OldRouterTest::Respect\Rest{closure}(), 1 passed and exactly 2 expected in /home/travis/build/Respect/Rest/tests/legacy/Respect/Rest/OldRouterTest.php on line 496

Rolling back doesn't resolve the issue so it is not related to the changes merged.

Found a fix the problem was in the sort order of the routes. Something that was odd anyway. We first checked for the number of / to prioritise the route then we look for the number of /* to de-prioritise the route but this never gets called because the previous statement already ordered based on the number of /. If we want to priorities the number of / in paths we need to remove the trailing wildcard paths first.

Not sure why this should be an issue now all of a sudden because it has been like this since 2012 see commit 3e56818

Anyway if the sort order aims to order routes from most specific to least specific then more wildcards must go down.

Also think it is better to sort the routes when added and the list changes instead of for every request.

Build success!! \o/