Adding fix for #2018

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4422 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-02-03 01:03:33 +00:00
parent 554433c7fb
commit 944e1d98bb

View file

@ -362,6 +362,14 @@ class Router extends Overloadable {
$_this->{$key} = $val;
}
}
function __notEmpty($var){
if($var === '0' || !empty($var)){
return true;
} else {
return false;
}
}
/**
* Finds URL for specified action.
*
@ -395,7 +403,6 @@ class Router extends Overloadable {
$extension = $output = $mapped = $q = null;
if (is_array($url) && !empty($url)) {
$url = array_filter($url);
if (isset($url['full_base']) && $url['full_base'] == true) {
$full = true;
@ -471,7 +478,8 @@ class Router extends Overloadable {
if(!isset($url['action'])) {
$url['action'] = null;
}
$urlOut = array_filter(array($url['plugin'], $url['controller'], $url['action'], join('/', array_filter($args)), $named));
$urlOut = array_filter(array($url['plugin'], $url['controller'], $url['action'], join('/', array_filter($args, array($_this, "__notEmpty"))), $named), array($_this, "__notEmpty"));
if($url['plugin'] == $url['controller']) {
array_shift($urlOut);
}