BUG description
A change occurred between v3.17.0 and v3.17.1 introduced a bug that is affecting the order in which Routes are matched.
This is likely to be caused by the new feature #658 that modifies the routing algorithm to check method-specific routes first.
To Reproduce
Sample code to reproduce the bug:
Flight::route("/@par/[^\/]+/*", function(string $par){
echo "Passthrough (Par = $par) <br>";
return true;
});
Flight::route("GET /[^\/]+/target", function(){
echo "Target";
});
Flight::start();
Expected behavior
Expected result (working until v.3.17.0):
Passthrough (Par = foobar)
Target
Starting from v.3.17.1 the first route defined does NOT get matched first and the output is:
Additional context
That regex is structured in that way in order to capture that first parameter in the URI, make some validation/adjustments and continue to the actual route, no matter what method is used.
I am fully aware that probably middleware would be more appropriate for flight-specific projects, but this is a stripped-down example from a very complex project that is currently relying on the assumption that Routes are matched in the order they are defined.
If keeping the original behaviour while preserving the new method-specific route matches is impossible, please consider adding a configuration option to turn off the new feature. This was definitely a breaking change for some projects.
BUG description
A change occurred between
v3.17.0andv3.17.1introduced a bug that is affecting the order in which Routes are matched.This is likely to be caused by the new feature #658 that modifies the routing algorithm to check method-specific routes first.
To Reproduce
Sample code to reproduce the bug:
Expected behavior
Expected result (working until
v.3.17.0):Starting from
v.3.17.1the first route defined does NOT get matched first and the output is:Additional context
That regex is structured in that way in order to capture that first parameter in the URI, make some validation/adjustments and continue to the actual route, no matter what method is used.
I am fully aware that probably middleware would be more appropriate for flight-specific projects, but this is a stripped-down example from a very complex project that is currently relying on the assumption that Routes are matched in the order they are defined.
If keeping the original behaviour while preserving the new method-specific route matches is impossible, please consider adding a configuration option to turn off the new feature. This was definitely a breaking change for some projects.