ZF-12414: Zend_Navigation_Page_Mvc marks routes with an empty parameter always active (with easy fix)


h2. Problem

I have a setup with multiple navigation pages, each haveing a different value for the slug parameter. Home has an empty slug.

If browse to any page with non-empty slug like news the news menu item will be active. Thats good. Whats wrong is that the home menu item will be marked as active as well, but that has an empty slug.

h3. Example code = Zend_Controller_Router_Route_Regex = "((?!(admin|page)).*)" = "page" = "index" = "index" = "slug" = "%s"

resources.navigation.pages.home.label            = 'About'
resources.navigation.pages.home.params.slug      = ''
resources.navigation.pages.home.encodeUrl        = true
resources.navigation.pages.home.route            = 'page'            = 'News'      = 'news'        = false            = 'page'

resources.navigation.pages.products.label        = 'Products'
resources.navigation.pages.products.params.slug  = 'products'
resources.navigation.pages.products.encodeUrl    = false
resources.navigation.pages.products.route        = 'page'

h2. Solution

Zend_Navigation_Page_Mvc::isActive() contains this code

foreach($myParams as $key => $value) {
   if($value == null) {

Imho the fault is in {color:red} {{==}} {color}, it should be strictly equal {color:green} {{===}} {color}


I will add a patch with unit tests.

Fixed on trunk (25212) and release-1.12 (25213)