Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix empty with long mandatory flag

  • Loading branch information...
commit d4358f9761e5dbf2dd1b31be326e135722985574 1 parent 54b63e1
@blanchonvincent authored
View
4 library/Zend/Mvc/Router/Console/Simple.php
@@ -652,8 +652,8 @@ public function match(Request $request, $pathOffset = null)
/**
* Try to retrieve value if it is expected
*/
- if (null === $value && $part['hasValue']) {
- if ($x < count($params)+1) {
+ if ((null === $value || "" === $value) && $part['hasValue']) {
+ if ($x < count($params)+1 && isset($params[$x])) {
// retrieve value from adjacent param
$value = $params[$x];
View
16 tests/ZendTest/Mvc/Router/Console/SimpleTest.php
@@ -602,8 +602,7 @@ public static function routeProvider()
);
}
-
-
+
/**
* @dataProvider routeProvider
* @param string $routeDefinition
@@ -631,6 +630,16 @@ public function testMatching($routeDefinition, array $arguments = array(), array
}
}
}
+
+ public function testCanNotMatchingWithEmtpyMandatoryParam()
+ {
+ $arguments = array('--foo=');
+ array_unshift($arguments,'scriptname.php');
+ $request = new ConsoleRequest($arguments);
+ $route = new Simple('--foo=');
+ $match = $route->match($request);
+ $this->assertEquals(null, $match);
+ }
/**
* @dataProvider routeProvider
@@ -666,8 +675,7 @@ public function __testParseExceptions($route, $exceptionName, $exceptionMessage)
$this->setExpectedException($exceptionName, $exceptionMessage);
new Simple($route);
}
-
-
+
public function testFactory()
{
$tester = new FactoryTester($this);
Please sign in to comment.
Something went wrong with that request. Please try again.