Hi,
like weierophinney pointed out (on GitHub
https://github.com/zendframework/zf2/issues/4731#issuecomment-20054297), i should ask my question here.
First: why i don't get an exception, when in the configuration is no constraints Index?
Second: The Problem with the Parameter where caused while debugging the Problem. Even with the following configuration i always get an Exception:
'default' => array(
'type' => 'segment',
'priority' => 10,
'options' => array(
'route' => '/:controller[/:action[/:id]]',
'constraints' => array(
'controller' => '[a-zA-Z_-]*',
'action' => '[a-zA-Z_-]*',
'id' => '[0-9]*',
),
'defaults' => array(
'controller' => 'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'search' => array(
'type' => 'Segment',
'options' => array(
'route' => '/type/:type[/search/:search]',
'constraints' => array(
'type' => '[A-Z][a-zA-Z]*',
'search' => '[A-Za-z]*',
),
'defaults' => array(
'type' => 'Member',
),
),
'may_terminate' => true,
'child_routes' => array(
'page' => array(
'type' => 'Segment',
'options' => array(
'route' => '/page/:page',
'constraints' => array(
'page' => '[0-9]*',
),
'defaults' => array(
'page' => 1,
),
),
),
),
),
),
),
),
So my Question is still: Why the Variable $hasChild is tested in the following code?
if (!$isOptional || $hasChild) {
throw new Exception\InvalidArgumentException(sprintf('Missing parameter "%s"', $part[1]));
}