Skip to content
Browse files

Merge branch '2.2'

* 2.2: (30 commits)
  [HttpFoundation] Added support for partial ranges in the BinaryFileResponse.
  [HttpFoundation] Fixed byte ranges in the BinaryFileResponse.
  updated required versions when depending on the HttpFoundation component
  updated required versions when depending on the HttpKernel component
  updated required versions when depending on the Config component
  updated required versions when depending on the Form component
  updated required versions when depending on the DependencyInjection component
  updated required versions when depending on the Validator component
  updated required versions when depending on the Translation component
  updated required versions when depending on the Routing component
  updated required versions when depending on the EventDispatcher component
  updated required versions when depending on the OptionsResolver component
  updated required versions when depending on the PropertyAccess component
  updated required versions when depending on the Security component
  updated required versions when depending on the Templating component
  updated required versions when depending on the Stopwatch component
  updated required versions when depending on the Process component
  updated required versions when depending on the Finder component
  updated required versions when depending on the Dom Crawler component
  use ~2.0 when depending on the Dom Crawler component
  ...
  • Loading branch information...
2 parents 03137c0 + d151052 commit a474133f6f5a94d0be166d2a428d7f5b63511de5 @fabpot fabpot committed
Showing with 19 additions and 6 deletions.
  1. +8 −0 Matcher/TraceableUrlMatcher.php
  2. +9 −3 Tests/Matcher/TraceableUrlMatcherTest.php
  3. +2 −3 composer.json
View
8 Matcher/TraceableUrlMatcher.php
@@ -70,6 +70,14 @@ protected function matchCollection($pathinfo, RouteCollection $routes)
continue;
}
+ // check host requirement
+ $hostMatches = array();
+ if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) {
+ $this->addTrace(sprintf('Host "%s" does not match the requirement ("%s")', $this->context->getHost(), $route->getHost()), self::ROUTE_ALMOST_MATCHES, $name, $route);
+
+ return true;
+ }
+
// check HTTP method requirement
if ($req = $route->getRequirement('_method')) {
// HEAD and GET are equivalent as per RFC
View
12 Tests/Matcher/TraceableUrlMatcherTest.php
@@ -24,21 +24,27 @@ public function test()
$coll->add('foo', new Route('/foo', array(), array('_method' => 'POST')));
$coll->add('bar', new Route('/bar/{id}', array(), array('id' => '\d+')));
$coll->add('bar1', new Route('/bar/{name}', array(), array('id' => '\w+', '_method' => 'POST')));
+ $coll->add('bar2', new Route('/foo', array(), array(), array(), 'baz'));
+ $coll->add('bar3', new Route('/foo1', array(), array(), array(), 'baz'));
$context = new RequestContext();
+ $context->setHost('baz');
$matcher = new TraceableUrlMatcher($coll, $context);
$traces = $matcher->getTraces('/babar');
- $this->assertEquals(array(0, 0, 0), $this->getLevels($traces));
+ $this->assertEquals(array(0, 0, 0, 0, 0), $this->getLevels($traces));
$traces = $matcher->getTraces('/foo');
- $this->assertEquals(array(1, 0, 0), $this->getLevels($traces));
+ $this->assertEquals(array(1, 0, 0, 2), $this->getLevels($traces));
$traces = $matcher->getTraces('/bar/12');
$this->assertEquals(array(0, 2), $this->getLevels($traces));
$traces = $matcher->getTraces('/bar/dd');
- $this->assertEquals(array(0, 1, 1), $this->getLevels($traces));
+ $this->assertEquals(array(0, 1, 1, 0, 0), $this->getLevels($traces));
+
+ $traces = $matcher->getTraces('/foo1');
+ $this->assertEquals(array(0, 0, 0, 0, 2), $this->getLevels($traces));
$context->setMethod('POST');
$traces = $matcher->getTraces('/foo');
View
5 composer.json
@@ -19,9 +19,8 @@
"php": ">=5.3.3"
},
"require-dev": {
- "symfony/config": "2.2.*",
- "symfony/yaml": "2.2.*",
- "symfony/http-kernel": "2.2.*",
+ "symfony/config": ">=2.2.*,<2.3-dev",
+ "symfony/yaml": "~2.0",
"doctrine/common": "~2.2",
"psr/log": "~1.0"
},

0 comments on commit a474133

Please sign in to comment.
Something went wrong with that request. Please try again.