Issues

ZF-7499: Zend_Controller_Router_Route_Regex won't follow ->chain

Description

I upgraded to 1.9 and found out that my site wasn't working properly. I found out this is because a Regex on one of my domains connected to the ZF system is also in effect on the other domain.

Trying to access /controller/action/param/teststring on domain2 works. But when I try to access /controller/action/param/123 (note that this is a number matching the regex) on domain2 then the regex rule in the code (for domain1) goes in to effect and the routing works unexpectedly.

I guess the chain() function applies the regex to all domains not just the specified domain as before.

My rewrite configuration looks like this:


$router = $frontController->getRouter ();

$domain1= new Zend_Controller_Router_Route_Hostname(
    ':subdomain.:domain.:tld',
    array(
        'module' => 'domain',
    ),
    array(
        'domain' => '([a-z0-9]+)',
    )
);
$router->addRoute('Pagination', $domain1->chain(new Zend_Controller_Router_Route_Regex ( '(.+)/(\d+)', 
    array ('controller' => 'page', 'action' => 'index'),array(1=> 'permalink', 2 => 'page')
)));

$domain2 = new Zend_Controller_Router_Route_Hostname(
    'static.:domaindomain.:tldtld',
    array(
        'module' => 'admin',
    )
);
$router->addRoute('Admin', $domain2->chain(new Zend_Controller_Router_Route(
    ':controller/:action/*', array('controller' => 'index', 'action' => 'index')
)));

Comments

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.