Fix in Router::generate(), replace matching key in url while looping through param_key.
otherwise, with route : /action/:type/:id , $router->generate($namedRoute,['id'=>1,'type'=>'type']) generate /action/1/type.
// loop trough parameter names, store matching value in $params array
foreach ($param_keys as $key) {
if (isset($params[$key])) {
- $url = preg_replace('/:(\w+)/', $params[$key], $url, 1);
+ $url = preg_replace('/:'.preg_quote($key).'/', $params[$key], $url, 1);
}
}
}