Skip to content

Commit

Permalink
small mods after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
basz committed Mar 9, 2012
1 parent 4df5c89 commit 21b80d4
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions library/Zend/Http/PhpEnvironment/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ protected function detectRequestUri()
// IIS7 with URL Rewrite: make sure we get the unencoded url
// (double slash problem).
$iisUrlRewritten = $this->server()->get('IIS_WasUrlRewritten');
$unencodedUrl = $this->server()->get('UNENCODED_URL', '');
$unencodedUrl = $this->server()->get('UNENCODED_URL', '');
if ('1' == $iisUrlRewritten && '' !== $unencodedUrl) {
return $unencodedUrl;
}
Expand Down Expand Up @@ -269,10 +269,10 @@ protected function detectRequestUri()
*/
protected function detectBaseUrl()
{
$baseUrl = '';
$filename = $this->server()->get('SCRIPT_FILENAME', '');
$scriptName = $this->server()->get('SCRIPT_NAME');
$phpSelf = $this->server()->get('PHP_SELF');
$baseUrl = '';
$filename = $this->server()->get('SCRIPT_FILENAME', '');
$scriptName = $this->server()->get('SCRIPT_NAME');
$phpSelf = $this->server()->get('PHP_SELF');
$origScriptName = $this->server()->get('ORIG_SCRIPT_NAME');

if ($scriptName !== null && basename($scriptName) === $filename) {
Expand All @@ -286,14 +286,14 @@ protected function detectBaseUrl()
// Backtrack up the SCRIPT_FILENAME to find the portion
// matching PHP_SELF.
$path = $phpSelf ?: '';
if (isset($path[1]) && $path[1] !== '~') {
if (!isset($path[1]) || $path[1] !== '~') {
$segments = array_reverse(explode('/', trim($filename, '/')));
} else {
$segments = array_reverse(explode('/', trim($phpSelf, '/')));
$segments = array_reverse(explode('/', trim($path, '/')));
}
$index = 0;
$last = count($segments);
$baseUrl = '';
$index = 0;
$last = count($segments);
$baseUrl = '';

do {
$segment = $segments[$index];
Expand Down Expand Up @@ -351,7 +351,7 @@ protected function detectBaseUrl()
protected function detectBasePath()
{
$filename = basename($this->server()->get('SCRIPT_FILENAME', ''));
$baseUrl = $this->getBaseUrl();
$baseUrl = $this->getBaseUrl();

// Empty base url detected
if ($baseUrl === '') {
Expand Down

0 comments on commit 21b80d4

Please sign in to comment.