ZF-9179: _getParam second parameter no longer working when used in conjunction with routes


Ever since we upgraded to ZF 1.9.7, _getParam no longer replaces "empty" values with the second parameter. This is related to ZF-5163.

When a route has been defined as follows:

$route = new Zend_Controller_Router_Route( ':lang/:controller/:action/*',
                    'action' => 'index',

and the user types a URL like "http://myapp.example.com//examplecontroller/exampleaction",

  • _getParam('lang') returns an empty string instead of null
  • _getParam('lang','en') now returns an empty string(!). Prior to ZF 1.9.7, it returns 'en', which is the expected result.

Since our application relies on routes, upgrading to 1.9.7 broke several major modules.


Still not fixed in 1.10.5...

Attaching patch.

Patch applied in trunk and 1.10 release branch.