ZF-11359: Zend_Navigation_Page_Mvc::isActive is not route aware

Issue Type: Improvement Created: 2011-05-10T20:39:34.000+0000 Last Updated: 2011-06-04T20:12:35.000+0000 Status: Resolved Fix version(s): - 1.11.8 (07/Jul/11)

Reporter: Môshe van der Sterre (môshevds) Assignee: Dolf Schimmel (Freeaqingme) (freak) Tags: - Zend_Navigation

Related issues: - ZF-8830

Attachments: - ZF-11359_Fix_Patch.diff


Zend_Navigation_Page_Mvc::isActive is not route aware, and will return false when the page is active, but uses a route.


Posted by Môshe van der Sterre (môshevds) on 2011-05-10T20:39:54.000+0000

Unit test:

Posted by Môshe van der Sterre (môshevds) on 2011-05-10T21:12:47.000+0000


Note that getDefaults is not a part of Zend_Controller_Router_Route_Interface, so the method_exists check is necessary. Also, Zend_Controller_Router_Route_Chain does not implement getDefaults, but I think that should be possible.

Posted by Kai Uwe (kaiuwe) on 2011-05-11T09:04:07.000+0000

Add patches from Môshe van der Sterre

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2011-05-11T12:38:16.000+0000

Kai, I see that you assigned this issue to yourself. Does that mean you're planninng on committing it? If not, please assign it to me so I can commit the patches.

Posted by Kai Uwe (kaiuwe) on 2011-05-11T12:45:54.000+0000

Hi Dolf, Feel free to commit. It does not matter who does it! :-)

Posted by Cristian Bichis (avantis) on 2011-05-26T14:58:56.000+0000

Anyone to commit ? Seems is affecting me as well...

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2011-05-26T15:09:42.000+0000

Hey Christian,

See also this tweet:…

tldr; will do so this weekend.

Posted by Cristian Bichis (avantis) on 2011-05-26T16:08:49.000+0000

Thanks Freeaqingme, take your time...

Posted by Marvin Feldmann (ganjalatte) on 2011-06-01T01:53:45.000+0000

As mentioned above this patch does not work for chained routes. I patched this issue by comparing the assembled URLs of the current route and the route used by Zend_Navigation_Page_Mvc:

<pre class="highlight">
if ($this->_route) {
     * Patch ZF-11359
     * For Zend_Controller_Router_Route_Chain
    try {
        if ($front->getRouter()->getCurrentRouteName() === $this->_route && $this->getHref() === self::$_urlHelper->url(array(), null, false, false)) {
            $this->_active = true;
            return true;
    } catch (Zend_Controller_Router_Exception $e) {

     * Patch ZF-11359
     * ZF-11359_Fix_Patch.diff
    $route = $front->getRouter()->getRoute($this->_route);
    if(method_exists($route, 'getDefaults')) {
        $myParams = array_merge($route->getDefaults(), $myParams);

Posted by Cristian Bichis (avantis) on 2011-06-02T07:40:01.000+0000

I guess would worth to check if the route is chained and only use the patch for a chained route.

This makes sense to avoid too much assemble processing....

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2011-06-04T00:15:42.000+0000

This issue was assigned to me because it was about merely applying a patch. Apparently the patch does not meet the quality standards ZF aims at. I am reassigning the issue, and assume it will not be resolved before ZF2.

Of course, this is not the case if a patch shows up that also supports chained links in a performant manner. Thank you for making ZF better!

Posted by Cristian Bichis (avantis) on 2011-06-04T11:05:16.000+0000

Freeaqingme, i suggest to at least patch with the initial solution, which works for non-chained routes. Otherwise it makes sense to fully remove the isActive related features...

I mean, there is a solution which is fixing for at least many of the cases so it makes sense to either apply the patch or remove the features (which i don't think is a choice would lead to BC break).

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2011-06-04T14:36:19.000+0000

Applied original patch(es). They should be released with version 1.11.8.

Committed in r24118 merged with release 1.11 branch in r24119. For the chained route stuff, please create a new issue.

Thank you for making ZF better.

Posted by Cristian Bichis (avantis) on 2011-06-04T20:12:35.000+0000

Thanks Freeaqingme.

I raised a new issue for the chained routes case:

Have you found an issue?

See the Overview section for more details.


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

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