8000 [routing] preg_match(): Compilation failed: unmatched parentheses · Issue #27504 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
8000

[routing] preg_match(): Compilation failed: unmatched parentheses #27504

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
zajca opened this issue Jun 5, 2018 · 8 comments
Closed

[routing] preg_match(): Compilation failed: unmatched parentheses #27504

zajca opened this issue Jun 5, 2018 · 8 comments

Comments

@zajca
Copy link
zajca commented Jun 5, 2018

Symfony version(s) affected: 4.1.0

Description
I'm having problem with router after 4.1 update on one of my routes I'm getting: Uncaught PHP Exception ErrorException: "Warning: preg_match(): Compilation failed: unmatched parentheses at offset 595" at /var/www/symfony/var/cache/dev/srcDevDebugProjectContainerUrlMatcher.php line 415 This looks like there is something wrong with generated regex.

Additional context

Here is generated regex
https://pastebin.com/egUBavqi

Routes in switch that matches url

849 => array(array('_route' => 'nsp_admin_package_createaction__invoke', '_format' => 'json', '_controller' => 'NSP\\Controller\\Admin\\Package\\CreateAction'), array('_format'), array('POST' => 0), null),
978 => array(array('_route' => 'nsp_admin_package_listaction__invoke', '_format' => 'json', '_controller' => 'NSP\\Controller\\Admin\\Package\\ListAction'), array('_format'), array('GET' => 0), null),

I'm calling: GET /admin/api/package.json

@nicolas-grekas
Copy link
Member

Can you provide a small reproducer? E.g. a small set of routes that reproduce this?

@nicolas-grekas
Copy link
Member
nicolas-grekas commented Jun 5, 2018

The regexps you linked on pastbin are valid, they do not generate this error.

Status: waiting feedback

@zajca
Copy link
Author
zajca commented Jun 6, 2018

I spend some time with this, removing vendor and do clean install helps :/ probably something wrong with update, sorry to bother.

@zajca zajca closed this as completed Jun 6, 2018
@zajca
Copy link
Author
zajca commented Jun 6, 2018

Sorry again, I just try run project in CI in clean environment and error still persists.
I'm not able to create minimal example. But figure out that it should be possible to run whole srcDevDebugProjectContainerUrlMatcher.php class alone.
So i created reproducer her: https://github.com/zajca/sf41-bug-routing-27504
There is whole auto-generated class with test.php which will trigger error.

@zajca zajca reopened this Jun 6, 2018
< 8000 div class="TimelineItem js-comment-container" data-gid="MDEyOklzc3VlQ29tbWVudDM5NTAzMzQxMg==" data-url="/symfony/symfony/comments/MDEyOklzc3VlQ29tbWVudDM5NTAzMzQxMg==/partials/timeline_issue_comment" >
@nicolas-grekas
Copy link
Member

I'm sorry but I cannot use your reproducer as the compiled container is just unreadable.
Anyway, can you check if #27511 fixes the issue?
If not, please provide a reproducer that starts from regular route configuration, so that I can compile on my own.
Thanks in advance.

@zajca
Copy link
Author
zajca commented Jun 6, 2018

I've checked #27511 but srcDevDebugProjectContainerUrlMatcher is just same.
I also tried to make reproducer by route configuration but routes are just fine, there is nothing special. Also all regex in srcDevDebugProjectContainerUrlMatcher are fine but still trigger error.

@zajca
Copy link
Author
zajca commented Jun 6, 2018

OK, i did reproduce this with 4 routes:
https://github.com/zajca/sf41-bug-routing-27504
Also try to apply patch from #27511 to routing component and result is same.

@nicolas-grekas
9407 Copy link
Member

Will be fixed by #27511

@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
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