From: Evan Prodromou Date: Mon, 3 Oct 2011 13:26:42 +0000 (-0400) Subject: Fix hand-made trim in getPath() with ltrim (duh) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c9d635b67555e74f9d54ca5c1895a2fd186de653;p=quix0rs-gnu-social.git Fix hand-made trim in getPath() with ltrim (duh) --- diff --git a/index.php b/index.php index 49fd187100..1566399fa2 100644 --- a/index.php +++ b/index.php @@ -59,7 +59,7 @@ function getPath($req) $path = $_SERVER['PATH_INFO']; $script = $_SERVER['SCRIPT_NAME']; if (substr($path, 0, mb_strlen($script)) == $script) { - $p = substr($path, mb_strlen($script)); + $p = substr($path, mb_strlen($script) + 1); } else { $p = $path; } @@ -69,11 +69,7 @@ function getPath($req) // Trim all initial '/' - if (!empty($p)) { - while ($p[0] == '/') { - $p = substr($p, 1); - } - } + $p = ltrim($p, '/'); return $p; }