Skip to content

Route with wildcard and different method can not be matched #29553

Closed
@Zombaya

Description

@Zombaya

Symfony version(s) affected: 4.1.8 - 4.1.9

Description
A route with a wildcard requested using the OPTIONS-method will not be matched. However, when viewing the exception using the symfony-profiler will show the correctly matched route.
Up until version 4.1.7 the route would be correctly matched.

This issue looks very similar to issue #29363 to me.

How to reproduce
Route definition
Note: I prefixed this route with /dav.

<route id="secotrust_sabre_dav" path="/{url}"
           methods="HEAD,GET,POST,OPTIONS,PROPFIND,PROPPATCH,MKCOL,COPY,MOVE,DELETE,LOCK,UNLOCK,PUT,PATCH,REPORT">
   <default key="_controller">secotrust.sabredav.controller::execAction</default>
   <default key="url"></default>
   <requirement key="url">/?.*</requirement>
   <option key="expose">true</option>
</route>

Request

OPTIONS /dav/files/IMIaj8lMzZsnx6mN5gheD7upxd5TqtjlUIMnrud3veqsHQwWZkKSE7pe8iWB4zTJ/ HTTP/1.1

Additional context
Stacktrace

Symfony\Component\Routing\Exception\ResourceNotFoundException:
  at var/cache/dev/srcDevDebugProjectContainerUrlMatcher.php:50
  at srcDevDebugProjectContainerUrlMatcher->match('/dav/files/IMIaj8lMzZsnx6mN5gheD7upxd5TqtjlUIMnrud3veqsHQwWZkKSE7pe8iWB4zTJ/')
     (vendor/symfony/routing/Matcher/UrlMatcher.php:107)
  at Symfony\Component\Routing\Matcher\UrlMatcher->matchRequest(object(Request))
     (vendor/symfony/routing/Router.php:262)

Screenshot of matching route
image

Result with GET-request
A GET-request would be redirected to the url without the trailing slash. Up until 4.1.7, this would just give the result from the controller-action.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions