Fix hand-made trim in getPath() with ltrim (duh)

This commit is contained in:
Evan Prodromou 2011-10-03 09:26:42 -04:00
parent 6145df6670
commit c9d635b675
1 changed files with 2 additions and 6 deletions

View File

@ -59,7 +59,7 @@ function getPath($req)
$path = $_SERVER['PATH_INFO']; $path = $_SERVER['PATH_INFO'];
$script = $_SERVER['SCRIPT_NAME']; $script = $_SERVER['SCRIPT_NAME'];
if (substr($path, 0, mb_strlen($script)) == $script) { if (substr($path, 0, mb_strlen($script)) == $script) {
$p = substr($path, mb_strlen($script)); $p = substr($path, mb_strlen($script) + 1);
} else { } else {
$p = $path; $p = $path;
} }
@ -69,11 +69,7 @@ function getPath($req)
// Trim all initial '/' // Trim all initial '/'
if (!empty($p)) { $p = ltrim($p, '/');
while ($p[0] == '/') {
$p = substr($p, 1);
}
}
return $p; return $p;
} }