Open BartChris opened 3 years ago
We were able to fix that by using the following Router::get('/posts/{id}', 'Controller@showRecord')->where('id', '.*');
but are inspecting wether this might have unintended consequences.
The documentation states: "By default, all parameters will match against all non / characters. You can make the match more specific by supplying a regular expression:"
This is probably not correct since dots seem to be not allowed witth standard settings.
Edit: We now changed it to Router::get('posts/{id}', function () {})->where('id', '[a-zA-Z0-9_.-]+');
to avoid including slashes
I've created a Pull Request https://github.com/Rareloop/router/pull/21 on the routing package to implement a fix. If this is not accepted we can update the documentation to make this clearer.
Hi there,
we are encountering an error when we put dots (".") in our route parameters. Is it allowed to do that?
What are the steps to reproduce this issue?
` Router::get('posts/{id}', function($id) {
}); Call URL /posts/a.b.c `
What happens?
Server returns 404
What were you expecting to happen?
Server returns the correct page
What versions of software are you using?
Operating System: Debian Buster
PHP Version: PHP 7.4
Lumberjack Version: 5.0.0
Thank you for your support!