Problem
active_for_routes() currently uses the provided prefix directly inside preg_match().
That means route prefixes containing regular expression characters can behave incorrectly or trigger unexpected matching behavior.
Current evidence
src/Twig/Extension/ActiveForRoutesExtension.php builds the pattern with "/^$routesStartsWith/i"
- the input is treated as regex syntax instead of plain route text
Expected behavior
Route prefixes should be matched as route text, not as arbitrary regular expressions.
Suggested work
- escape the user-provided prefix before building the regex
- keep the current support for matching both the raw prefix and the
admin_ prefixed variant
- add tests for prefixes containing regex-special characters
Problem
active_for_routes()currently uses the provided prefix directly insidepreg_match().That means route prefixes containing regular expression characters can behave incorrectly or trigger unexpected matching behavior.
Current evidence
src/Twig/Extension/ActiveForRoutesExtension.phpbuilds the pattern with"/^$routesStartsWith/i"Expected behavior
Route prefixes should be matched as route text, not as arbitrary regular expressions.
Suggested work
admin_prefixed variant