I have a route configuration:
<route id="some_route" path="/special/path/{some_strings}">
<default key="_controller">SpecialControllerBundle:Default:index</default>
<requirement key="some_strings">1.1|1.2|1.3</requirement>
</route>
By specifications allow only 1.1
, 1.2
, 1.3
strings are valid as some_strings parameter.
So I call myhost/special/path/1.1
- and it works just fine.
But for some reason I can call myhost/special/path/1,1
(notice the comma) - and somehow it matches the requirements and passes data to the controller.
If I call some illegal requirement myhost/special/path/2.3
it gives 404 as it should.
Symfony 3.4 dependencies are used.
<requirement key="some_strings">1.1|1.2|1.3</requirement>
These are not strings that get matched literally, but as regular expressions. .
in a regular expression means any arbitrary character. If you don’t want this special meaning, then you need to escape the dot, by prefixing it with a backslash.
<requirement key="some_strings">1\.1|1\.2|1\.3</requirement>