ZF2-407: Url view helper gives urls that doesn't work when using index as action

Issue Type: Bug Created: 2012-07-18T09:03:39.000+0000 Last Updated: 2012-10-08T20:15:07.000+0000 Status: Closed Fix version(s): Reporter: Mats Svensson (matskrug) Assignee: Ben Scholzen (dasprid) Tags: - Zend\Mvc\Router

Related issues: - ZF2-408



Or it may be the other way around, that these routes should work but doesn't. Anyhow, there is a mismatch between the view helper and the route resolver. See my SO post here, where I encounter the issue:

I have a route like this:

<pre class="highlight">
'xmlcoverage' => array(
        'type'    => 'segment',
        'options' => array(
                'route' => '/xml/coverage[/:action][/:id]',
                'constraints' => array(
                        'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'id'     => '[0-9]+',
                'defaults' => array(
                        'controller' => 'modulename/xmlcoverage',
                        'action'     => 'index',

I use the url view helper like this:

<pre class="highlight">
$this->url('xmlcoverage', array('action' => 'index', 'id' => $someid))

This gives me xml/coverage/33 which crashes. "The requested controller was unable to dispatch the request." I believe an id after the controller should map to index action, but it does not. But if it does not, at least the url helper should make the url work, like xml/coverage/index/33


Posted by Ralph Schindler (ralph) on 2012-10-08T20:15:07.000+0000

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit:

Have you found an issue?

See the Overview section for more details.


© 2006-2017 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.