diff --git a/library/Zend/Mvc/Router/Http/Segment.php b/library/Zend/Mvc/Router/Http/Segment.php index 6c64a96e792..93acafd6a62 100644 --- a/library/Zend/Mvc/Router/Http/Segment.php +++ b/library/Zend/Mvc/Router/Http/Segment.php @@ -273,7 +273,7 @@ protected function buildPath(array $parts, array $mergedParams, $isOptional, $ha $skippable = true; $optionalPart = $this->buildPath($part[1], $mergedParams, true, $hasChild); - if ($optionalPart !== null) { + if ($optionalPart !== '') { $path .= $optionalPart; $skip = false; } diff --git a/tests/ZendTest/Mvc/Router/Http/SegmentTest.php b/tests/ZendTest/Mvc/Router/Http/SegmentTest.php index ea7dd28de43..9df3c036250 100644 --- a/tests/ZendTest/Mvc/Router/Http/SegmentTest.php +++ b/tests/ZendTest/Mvc/Router/Http/SegmentTest.php @@ -111,6 +111,12 @@ public static function routeProvider() null, array('foo' => 'bar', 'bar' => 'baz') ), + 'optional-group-within-optional-group-is-ignored' => array( + new Segment('/:foo[/:bar[/:baz]]', array(), array('bar' => 'baz', 'baz' => 'bat')), + '/bar', + null, + array('foo' => 'bar', 'bar' => 'baz', 'baz' => 'bat') + ), 'non-standard-delimiter-before-parameter' => array( new Segment('/foo-:bar'), '/foo-baz',