Fix for GitHub issue 2511 #3355

Closed
wants to merge 1 commit into
from
@@ -95,7 +95,7 @@ public function match(Request $request, $pathOffset = null)
$path = $uri->getPath();
if ($pathOffset !== null) {
- if ($pathOffset >= 0 && strlen($path) >= $pathOffset) {
+ if ($pathOffset >= 0 && strlen($path) >= $pathOffset && !empty($this->route)) {
if (strpos($path, $this->route, $pathOffset) === $pathOffset) {
return new RouteMatch($this->defaults, strlen($this->route));
}
@@ -130,4 +130,14 @@ public function testFactory()
)
);
}
+
+ /**
+ * @group ZF2-436
+ */
+ public function testEmptyLiteral()
+ {
+ $request = new Request();
+ $route = new Literal('');
+ $this->assertNull($route->match($request, 0));
+ }
}