ZF-7246: Zend_Controller_Router_Rewrite should not use array_merge in assemble
Description
Zend_Controller_Router_Rewrite::assemble is currently using array_merge to merge user provided parameters and global parameters.
$params = array_merge($this->_globalParams, $userParams);
This way user provided parameters that contain numeric keys are reset/changed
A common example would be:
echo $this->view->url(array('4'=>'M', 'page'=>2));
or
$router = new Zend_Controller_Router_Rewrite();
echo $router->assemble (array('4'=>'M', 'page'=>2));
will return "/index/index/0/M/page/2" expecting: "/index/index/4/M/page/2"
Should use the "+" operator or a function that can merge arrays and preserve numeric keys like the one used in Zend_Controller_Router_Route_Regex::_arrayMergeNumericKeys().
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2009-07-11T19:10:03.000+0000
Assigning to Ben
Posted by Ramon Henrique Ornelas (ramon) on 2010-11-29T00:49:24.000+0000
Resolving as duplicate. See ZF-8914