8000 [Routing] backreferences in requirements regex · Issue #8139 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Routing] backreferences in requirements regex #8139
Closed
@skydiablo

Description

@skydiablo

query parameter requirements regex:

/**
 * @Route(
 *      "/search/{mac}", 
 *      name="MediaAccessControlVendorLookupSearch",
 *      requirements={"mac" = "(?:[[:xdigit:]]{2}([-:]))(?:[[:xdigit:]]{2}\2){4}[[:xdigit:]]{2}"}
 * )
 */
public function searchAction($mac) {
  ...
}

this will end in this exception

An exception has been thrown during the rendering of a template ("Warning: preg_match(): Compilation failed: reference to non-existent subpattern at offset 66...

thats right, but i have to use the referenz "\2", the routeMatcher need this behaivor

if (0 === strpos($pathinfo, '/vendorLookup/search') && preg_match('#^/vendorLookup/search/(?P<mac>(?:[[:xdigit:]]{2}([-:]))(?:[[:xdigit:]]{2}\\2){4}[[:xdigit:]]{2})$#s', $pathinfo, $matches)) {

so what is to do ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0