zendframework / zend-router

Standalone routing implementation for HTTP and console requests
BSD 3-Clause "New" or "Revised" License
32 stars 20 forks source link

Combination of MVC+Middleware+Wildcard Route give the error #46

Closed popovserhii closed 6 years ago

popovserhii commented 6 years ago

I was inspired by Middleware and try it using with Zend MVC as described here. All worked well until I tried using Wildcard route. When a route has 'middleware' config key with an array of Middleware applied it arise error rawurlencode() expects parameter 1 to be string, array given in Wildcard::assemble().

Minimal routes configuration to get error

return [
    'routes' => [
        'default' => [
            'type' => 'Segment',
            'options' => [
                'route' => '/[:controller[/[:action]]]',
                'constraints' => [
                    'controller' => '[a-zA-Z]?[a-zA-Z0-9_-]*',
                    'action' => '[a-zA-Z]?[a-zA-Z0-9_-]*',
                ],
                'defaults' => [
                    'middleware' => [Page\ConnectivePage::class, Page\RendererMiddleware::class],
                    'controller' => 'index',
                    'action' => 'index',
                ],
            ],
            'may_terminate' => true,
            'child_routes' => [
                'wildcard' => [
                    'type' => 'Wildcard',
                    'priority' => 10,
                    'options' => [],
                ],
            ],
        ],
    ],
];

image

froschdesign commented 6 years ago

@popovserhii Please keep in mind, the route type Wildcard is deprecated.

https://docs.zendframework.com/zend-router/routing/#zend92router92http92wildcard-deprecated

popovserhii commented 6 years ago

@froschdesign Does this mean that bug won't be fixed?

froschdesign commented 6 years ago

That‘s not the question! You should not use this route type because of the potential security issue.

popovserhii commented 6 years ago

I don't mind that there is a potential security issue. Could you give a link where I can read about this problem in more detail?

froschdesign commented 6 years ago

At the moment I can found only that: https://github.com/zendframework/zf2-documentation/issues/1320