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

Description

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


resources.router.routes.page.type = Zend_Controller_Router_Route_Regex
resources.router.routes.page.route = "((?!(admin|page)).*)"
resources.router.routes.page.defaults.module = "page"
resources.router.routes.page.defaults.controller = "index"
resources.router.routes.page.defaults.action = "index"
resources.router.routes.page.map.1 = "slug"
resources.router.routes.page.reverse = "%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'

resources.navigation.pages.news.label            = 'News'
resources.navigation.pages.news.params.slug      = 'news'
resources.navigation.pages.news.encodeUrl        = false
resources.navigation.pages.news.route            = '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) {
       unset($myParams[$key]);
   }
}

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

Comments

I will add a patch with unit tests.

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