Skip to content

Commit

Permalink
Fix for URL class when Apache uses PHP FastCGI
Browse files Browse the repository at this point in the history
Fix for #999
  • Loading branch information
eSilverStrike committed Nov 21, 2019
1 parent f0f1327 commit 1c52db5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/links/functions.inc
Expand Up @@ -98,7 +98,7 @@ function plugin_getmenuitems_links()
return false;
}

$menuitems[$LANG_LINKS[114]] = $_CONF['site_url'] . '/links/index.php';
$menuitems[$LANG_LINKS[114]] = COM_buildURL($_CONF['site_url'] . '/links/index.php');

return $menuitems;
}
Expand Down
13 changes: 11 additions & 2 deletions system/classes/url.class.php
Expand Up @@ -239,8 +239,17 @@ private function getArguments()
}
array_shift($this->arguments);
} elseif (isset($_ENV['ORIG_PATH_INFO'])) {
$this->arguments = explode('/', substr($_ENV['ORIG_PATH_INFO'], 1));
$check_for_dirs = true;
if ($_ENV['ORIG_PATH_INFO'] == $_SERVER['SCRIPT_NAME']) {
// Added this check for Apache to work for PHP FastCGI
// This check is needed if the url does not contain any variables (ie "/links/index.php") in FastCGI on Apache.
// If contains variable then $_SERVER['PATH_INFO'] gets set (with or with out using FastCGI)
// On Apache that does not use FastCGI then none of the variables gets set ($_SERVER['PATH_INFO'], $_ENV['ORIG_PATH_INFO'], $_SERVER['ORIG_PATH_INFO'])
// so it ends up in the ELSE of the original IF statement
$this->arguments = array();
} else {
$this->arguments = explode('/', substr($_ENV['ORIG_PATH_INFO'], 1));
$check_for_dirs = true;
}
} elseif (isset($_SERVER['ORIG_PATH_INFO'])) {
$this->arguments = explode('/', substr($_SERVER['ORIG_PATH_INFO'], 1));
$check_for_dirs = true;
Expand Down

0 comments on commit 1c52db5

Please sign in to comment.