Issue Bug Closed

#87731ExtbasePluginEnhancer requirements ignored

Kalle Karlson 02/18/19, 14:27 updated 01/23/20, 11:46

Description

hello, i’ve tried a little bit arround with the ExtbasePluginEnhancer to get my routes matched. This works in general but if the regex should respect the requirements it fails.

In the ExtbasePluginEnhancer::getVariant() method on line 97 is a piece of code witch should set the requirements, but it always set empty requirements. Because the namespaced variables did not match the compiled variable names.

config:

    type: Extbase
    limitToPages:
      - 103
    extension: umantis
    plugin: overview
    routes:
      -
        routePath: '/{employmentType}/{jobType}/p{page}'
        _controller: 'Overview::filter'
        _arguments:
          employmentType: jobFilter/employmentType
          jobType: jobFilter/jobType
          page: pagePointer
      -
        routePath: '/{employmentType}/{jobType}/{location}'
        _controller: 'Overview::filter'
        _arguments:
          employmentType: jobFilter/employmentType
          jobType: jobFilter/jobType
          location: jobFilter/location

    defaultController: 'Overview::show'
    requirements:
      employmentType: '^[a-zA-Z \-_]*$'
      jobType: '^[a-zA-Z \-_]*$'
      location: '^[a-zA-Z \-_]*$'
      page: \d+

If we get an route like “/employment/job/p2” the first route should match, if the route is “/employment/job/pitsburg”, the second route should match. But because no requirements are set, the first route matched both.

If we use:

$requirements = $this->deflateParameters($route, [$this->namespace => $this->configuration['requirements']]);

to get the requirements its working for me.

Reviews 1