Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Routing][AnnotationClassLoader] fix utf-8 encoding in default route name#31421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Tobion commentedMay 8, 2019
I don't see why the |
nicolas-grekas commentedMay 8, 2019
I'd suspect because strtolower is locale-sensitive. We could have something like: $name =str_replace('\\','_',$class->name).'_'.$method->name;$name =\function_exists('mb_strtolower') &&preg_match('//u',$name) ?mb_strtolower($name,'UTF-8') :strtolower($name); |
przemyslaw-bogusz commentedMay 8, 2019
@Tobion That's very interesting. From my experience, As for the BC break - keeping in mind that each bug fix can be considered a BC break - this method is used only when a route has no name. So, it could potentially be a problem for someone, who uses routing but does not name the routes. |
przemyslaw-bogusz commentedMay 8, 2019
@nicolas-grekas As I understand, you want to check if the string contains a unicode character? |
nicolas-grekas commentedMay 9, 2019
that would break if any other encoding is used - mb requires knowing the charset before using it. |
przemyslaw-bogusz commentedMay 9, 2019
|
nicolas-grekas commentedMay 11, 2019
LGTM, could you add a test case please? |
src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedMay 13, 2019
The tests are failing on appveyor. Windows doesn't like unicode names... We should find a test case that doesn't rely on the filesystem willingness :) |
przemyslaw-bogusz commentedMay 13, 2019
I've changed the name of the fixture class and now all tests pass. By the way, I think there might be a few more similar unicode issues hidden inside the Symfony code, e.g. method |
fabpot commentedMay 18, 2019
Thank you@przemyslaw-bogusz. |
…ault route name (przemyslaw-bogusz)This PR was squashed before being merged into the 3.4 branch (closes#31421).Discussion----------[Routing][AnnotationClassLoader] fix utf-8 encoding in default route name| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| License | MITIf controller, or one of its methods, contain a unicode character and you run:```./bin/console debug:router```you get this:This PR fixes it into this:Commits-------7ab52d3 [Routing][AnnotationClassLoader] fix utf-8 encoding in default route name
If controller, or one of its methods, contain a unicode character and you run:
you get this:

This PR fixes it into this:
