Merge branch '2.7' into 2.8

* 2.7:
  use Precise on Travis to keep PHP LDAP support
  fix(security): ensure the 'route' index is set before attempting to use it
This commit is contained in:
Nicolas Grekas 2017-07-21 13:02:55 +02:00
commit 6158ab363d
3 changed files with 15 additions and 1 deletions

View File

@ -1,5 +1,6 @@
language: php
dist: precise
sudo: false
git:

View File

@ -108,7 +108,7 @@ class HttpUtils
$parameters = $this->urlMatcher->match($request->getPathInfo());
}
return $path === $parameters['_route'];
return isset($parameters['_route']) && $path === $parameters['_route'];
} catch (MethodNotAllowedException $e) {
return false;
} catch (ResourceNotFoundException $e) {

View File

@ -221,6 +221,19 @@ class HttpUtilsTest extends TestCase
$utils->checkRequestPath($this->getRequest(), 'foobar');
}
public function testCheckPathWithoutRouteParam()
{
$urlMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\UrlMatcherInterface')->getMock();
$urlMatcher
->expects($this->any())
->method('match')
->willReturn(array('_controller' => 'PathController'))
;
$utils = new HttpUtils(null, $urlMatcher);
$this->assertFalse($utils->checkRequestPath($this->getRequest(), 'path/index.html'));
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Matcher must either implement UrlMatcherInterface or RequestMatcherInterface