Strict mode affecting lumen routes
- Dominant language
- PHP
- Stars
- 9.4k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
| Q | A
| ----------------- | ---
| Bug? | yes
| New Feature? | no
| Framework | Lumen
| Framework version | 5.6
| Package version | 2.0.0-alpha2
| PHP version | 7.1
#### Actual Behaviour
Lumen route get validated by Dingo Acc
#### Expected Behaviour
Dingo strict mode shouldn't affect routes outside its own API
#### Steps to Reproduce
Enable strict mode, create a get request using Lumen router, see the exception.
#### Possible Solutions
Seems like the culprit is here:
HttpServiceProvider.php
```
$this->app->singleton(Request::class, function ($app) {
$middleware = new Middleware\Request(
$app,
$app[ExceptionHandler::class],
$app[Router::class],
$app[RequestValidator::class],
$app['events']
);
$middleware->setMiddlewares($this->config('middleware', false));
return $middleware;
});
```
Looks like it's injecting into the whole request middleware not just the app('Dingo\Api\Routing\Router');
I even went as far as creating a global middleware to inject the header as suggested here:
https://github.com/dingo/api/issues/734 but it's pretty clear by debugging with dd that the Accept::validate method takes precedence over everything else.
I also found references to the issue here: https://github.com/dingo/api/issues/494
Contributor guide
Assessment
This issue has not been assessed yet.