Skip to content

Commit

Permalink
Fixes #414 - Segments containing a colon were not being parsed incorr…
Browse files Browse the repository at this point in the history
…ectly. Also made the URI detection a little more forgiving on the index_file config option.
  • Loading branch information
dhrrgn committed Aug 29, 2011
1 parent 823731a commit 7a5302f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
19 changes: 8 additions & 11 deletions classes/input.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,7 @@ public static function uri()
// Fall back to parsing the REQUEST URI
if (isset($_SERVER['REQUEST_URI']))
{
// Some servers require 'index.php?' as the index page
// if we are using mod_rewrite or the server does not require
// the question mark, then parse the url.
if (\Config::get('index_file') != 'index.php?')
{
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
}
else
{
$uri = $_SERVER['REQUEST_URI'];
}
$uri = $_SERVER['REQUEST_URI'];
}
else
{
Expand All @@ -113,6 +103,13 @@ public static function uri()
$uri = substr($uri, strlen($index_file));
}

// When index.php? is used and the config is set wrong, lets just
// be nice and help them out.
if ($index_file and strncmp($uri, '?/', 2) === 0)
{
$uri = substr($uri, 1);
}

// Lets split the URI up in case it containes a ?. This would
// indecate the server requires 'index.php?' and that mod_rewrite
// is not being used.
Expand Down
3 changes: 2 additions & 1 deletion classes/route.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ class Route {

public function __construct($path, $translation = null)
{
Debug::dump($path, $translation);
$this->path = $path;
$this->translation = ($translation === null) ? $path : $translation;
$this->search = ($translation === null) ? $path : $this->compile();
$this->search = ($translation == stripslashes($path)) ? $translation : $this->compile();
}

protected function compile()
Expand Down

0 comments on commit 7a5302f

Please sign in to comment.