ZF-3212: Inconsistent initialization of routes' path variables

Issue Type: Bug Created: 2008-05-06T23:58:49.000+0000 Last Updated: 2008-09-02T10:39:07.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: Michal Minicki (martel) Assignee: Michal Minicki (martel) Tags: - Zend_Controller

Related issues: - ZF-3219



Andriess Seutens:

I have a little issue with the url helper and route matching. I think this is a critical missing feature / bug. I'm going to try to explain my issue by example:

My bootstrap file:

<pre class="highlight">

require_once 'Zend/Loader.php';

$frontController = Zend_Controller_Front::getInstance();

$router = $frontController->getRouter();
$router->addRoute('foo', new Zend_Controller_Router_Route(
        'lang'       => 'nl',
        'controller' => 'index',
        'action'     => 'index'

$router->addRoute('bar', new Zend_Controller_Router_Route(
        'lang'       => 'nl',
        'controller' => 'index',
        'action'     => 'index'

$response = $frontController->dispatch();

My template file:

<pre class="highlight">
<?php echo $this->url(array(), 'foo') ?>
<?php echo $this->url(array(), 'bar') ?>

when i call: http://mydomain/nl/bar the output is:

/nl/foo /nl/bar

which is good!

if i call: http://mydomain/en/foo the output is

/en/foo /en/bar

which is good too!

the problem occurs when the last route in the row is matched (in this case: 'bar')



/nl/foo /en/bar

works for all routes after the matched one, but not the ones before.....

In order for this to work I would need to pass in the 'lang' parameter:

<pre class="highlight"><?php echo $this->url(array('lang' =>
'foo') ?>

So, in other words: I am unable to take a url param into each route and use it with the url helper?

Best, Andriesss {quote}


Posted by Michal Minicki (martel) on 2008-05-07T03:26:37.000+0000

Probably temporary fix to inconsistent route path variables handling.

Posted by Michal Minicki (martel) on 2008-05-08T09:04:23.000+0000

The proposed fix is in a direct conflict with the linked issue. I will fix the problem the other way - routes will not be initialized with url values on negative match. I will provide a way to use request variables in a route on a router assembly level.

Posted by Michal Minicki (martel) on 2008-05-08T09:40:36.000+0000

Fixed in opposite way:

http://mydomain/nl/bar => /nl/foo, /nl/bar http://mydomain/en/foo => /en/foo, /nl/bar http://mydomain/en/bar => /nl/foo, /en/bar

Posted by Wil Sinclair (wil) on 2008-09-02T10:39:07.000+0000

Updating for the 1.6.0 release.

Have you found an issue?

See the Overview section for more details.


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

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