thephpleague / route

Fast PSR-7 based routing and dispatch component including PSR-15 middleware, built on top of FastRoute.
http://route.thephpleague.com
MIT License
651 stars 126 forks source link

Host condition is not working in v5.0.1 #298

Closed gocebonev closed 3 years ago

gocebonev commented 3 years ago

In v5.0.1 the host condition is not working. The following code worked ok with 4.5 but throws an error in 5.

$router->map('GET', '/', ExampleController::class . '::hello')
    ->setHost('test1.com');

$router->map('GET', '/', TestRestController::class . '::hello')
    ->setHost('test2.com');

Error: Can not register two routes for '/'.

philipobenito commented 3 years ago

Thanks @gocebo I'll look at this asap

philipobenito commented 3 years ago

@gocebo sorry for the delay in fixing, seems there was a change in FastRoute, so now I'm pre-checking conditions before mapping routes.

philipobenito commented 3 years ago

I've had to make this a 6.x release as it breaks the cached router, another small BC change will come alongside it but it will be a minimal upgrade procedure

philipobenito commented 3 years ago

I spoke too soon on it being a BC break, it isn't, so I've tagged 5.1.1