Index: tests/Zend/Controller/Router/RewriteTest.php =================================================================== --- tests/Zend/Controller/Router/RewriteTest.php (revision 22179) +++ tests/Zend/Controller/Router/RewriteTest.php (working copy) @@ -732,6 +732,37 @@ $this->assertEquals('/articles/777', $url); } + + + /** + * Test that it is possible to generate a URL with a numerical key + * + * @since 2010-05-16 + * @group ZF-8914 + * @covers Zend_Controller_Router_Rewrite::assemble + */ + public function testCanGenerateNumericKeyUri() + { + $this->_router->addRoute( + 'default', + new Zend_Controller_Router_Route( + ':controller/:action/*', + array('controller' => 'index', 'action' => 'index') + ) + ); + + $params = array( + 'controller' => 'index', + 'action' => 'index', + '2' => 'foo', + 'page' => 'bar', + ); + + $this->assertEquals( + '/index/index/2/foo/page/bar', + $this->_router->assemble($params) + ); + } } Index: library/Zend/Controller/Router/Rewrite.php =================================================================== --- library/Zend/Controller/Router/Rewrite.php (revision 22179) +++ library/Zend/Controller/Router/Rewrite.php (working copy) @@ -458,7 +458,8 @@ } } - $params = array_merge($this->_globalParams, $userParams); + // Use UNION (+) in order to preserve numeric keys + $params = $userParams + $this->_globalParams; $route = $this->getRoute($name); $url = $route->assemble($params, $reset, $encode);