10000 "invalid UTF-8 string" exception when upgraded to 4.1 · Issue #27448 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

"invalid UTF-8 string" exception when upgraded to 4.1 #27448

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SvetlinStaev opened this issue May 31, 2018 · 4 comments
Closed

"invalid UTF-8 string" exception when upgraded to 4.1 #27448

SvetlinStaev opened this issue May 31, 2018 · 4 comments

Comments

@SvetlinStaev
Copy link

Symfony version(s) affected: 4.1.0

Description
My current application is running on 3.4.11, today I tried to upgrade it to the latest 4.1.0 but when I boot it up I get the following:

preg_match(): Compilation failed: invalid UTF-8 string at offset 993

With a stack trace ending at the PhpMatcherDumper trying to match the following expression

{^(?|/en/(?|classifieds/(?|([^/]+)\-(\d+)\.html(*:1281)|([^/]+)\-(\d+)/print(*:1310)|([^/]+)\-(\d+)/share(*:1339)|([^/]+)\-(\d+)/gallery(*:1370)|([^/]+)\-(\d+)/report\-problem(*:1409)|([^/]+)\-(\d+)/promote(*:1440)|logout/(\d+)(*:1461)|update/(\d+)(*:1482)|delete/(\d+)(*:1503))|обяви/(?|([^/]+)\-(\d+)/отпечатай(*:1560)|([^/]+)\-(\d+)/успешно\-докладван\-проблем(*:1634)|([^/]+)\-(\d+)/оферта(*:1670)|(\d+)/обявата\-изтрита\-успешно(*:1731))|listings/new\-password/(\d+)/([^/]++)(*:1778))|/обяви/(?|([^/]+)\-(\d+)\.html(*:1823)|([^/]+)\-(\d+)/принтирай(*:1865)|([^/]+)\-(\d+)/отпечатай(*:1907)|([^/]+)\-(\d+)/изпрати\-на\-приятел(*:1967)|([^/]+)\-(\d+)/снимки(*:2003)|([^/]+)\-(\d+)/докладвай\-проблем(*:2061)|([^/]+)\-(\d+)/успешно\-докладван\-проблем(*:2135)|([^/]+)\-(\d+)/промотирай(*:2179)|([^/]+)\-(\d+)/оферта(*:2215)|из�(?|�од/(\d+)(*:2243)|�рий\-обява/(\d+)(*:2277))|редактиране\-на\-обява/(\d+)(*:2333)|(\d+)/обявата\-изтрита\-успешно(*:2394))|/listings/new\-password/(\d+)/([^/]++)(*:2442))$}sDu

It breaks on some UTF-8 characters, trying to match two routes - /изход and /изтрий-обява which have the same first two letters.

How to reproduce

The two routes are defined as:

listing_logout:
    path: /обяви/изход/{id}
    defaults:
        _controller: AppBundle:Listing/Login:listingLogout
    requirements:
        id: \d+
    options:
        utf8: true

and

listing_delete:
    path: /обяви/изтрий-обява/{id}
    defaults:
        _controller: AppBundle:Listing/Listing:delete
    requirements:
        id: \d+
    options:
        utf8: true

Possible Solution

Additional context

@nicolas-grekas
Copy link
Member

would you be able to provide a repository we could clone to reproduce easily?

@SvetlinStaev
Copy link
Author

The repository is private but I extracted a sample one with the whole route collection to illustrate the issue. It is available at this branch - https://github.com/SvetlinStaev/symfony/tree/test/utf_routing_issue

@nicolas-grekas
Copy link
Member

Thanks for the reproducer, I'm on a fix now.

@fabpot fabpot closed this as completed Jun 10, 2018
fabpot added a commit that referenced this issue Jun 10, 2018
…n-capturing groups (nicolas-grekas)

This PR was merged into the 4.1 branch.

Discussion
----------

[Routing] fix matching host patterns, utf8 prefixes and non-capturing groups

| Q             | A
| ------------- | ---
| Branch?       | 4.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #27448, #27461, #27504, #27512
| License       | MIT
| Doc PR        | -

Commits
-------

465b15c [Routing] fix matching host patterns, utf8 prefixes and non-capturing groups
@SvetlinStaev
Copy link
Author

Tried it on the latest 4.2.0-dev including the fix, works great! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
0