Skip to content

Commit

Permalink
Changed server check to ensure SCRIPT_NAME is defined. Fixes bcit-ci#57
Browse files Browse the repository at this point in the history
  • Loading branch information
ericlbarnes committed Apr 18, 2011
1 parent 9e26798 commit 26eebdd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions system/core/URI.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function _fetch_uri_string()
$path = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri);
$this->_set_uri_string($path);
}

// --------------------------------------------------------------------

/**
Expand All @@ -133,7 +133,7 @@ function _set_uri_string($str)
{
// Filter out control characters
$str = remove_invisible_characters($str, FALSE);

// If the URI contains only a slash we'll kill it
$this->uri_string = ($str == '/') ? '' : $str;
}
Expand All @@ -151,7 +151,7 @@ function _set_uri_string($str)
*/
private function _detect_uri()
{
if ( ! isset($_SERVER['REQUEST_URI']))
if ( ! isset($_SERVER['REQUEST_URI']) OR ! isset($_SERVER['SCRIPT_NAME']))
{
return '';
}
Expand Down Expand Up @@ -184,12 +184,12 @@ private function _detect_uri()
$_SERVER['QUERY_STRING'] = '';
$_GET = array();
}

if ($uri == '/' || empty($uri))
{
return '/';
}

$uri = parse_url($uri, PHP_URL_PATH);

// Do some final cleaning of the URI and return it
Expand Down

0 comments on commit 26eebdd

Please sign in to comment.