Skip to content
Snippets Groups Projects
Commit 99216444 authored by Lukas Reschke's avatar Lukas Reschke
Browse files

Add blackmagic due to cyclic dependency :see_no_evil:

parent 9f91d649
Branches
No related tags found
No related merge requests found
......@@ -104,7 +104,14 @@ class OC {
* FIXME: The following line is required because of a cyclic dependency
* on IRequest.
*/
$scriptName = $_SERVER['SCRIPT_NAME'];
$params = [
'server' => [
'SCRIPT_NAME' => $_SERVER['SCRIPT_NAME'],
'SCRIPT_FILENAME' => $_SERVER['SCRIPT_FILENAME'],
],
];
$fakeRequest = new \OC\AppFramework\Http\Request($params, null, new \OC\AllConfig(new \OC\SystemConfig()));
$scriptName = $fakeRequest->getScriptName();
if (substr($scriptName, -1) == '/') {
$scriptName .= 'index.php';
//make sure suburi follows the same rules as scriptName
......
......@@ -80,7 +80,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
* @see http://www.php.net/manual/en/reserved.variables.php
*/
public function __construct(array $vars=array(),
ISecureRandom $secureRandom,
ISecureRandom $secureRandom = null,
IConfig $config,
$stream='php://input') {
$this->inputStream = $stream;
......@@ -596,8 +596,8 @@ class Request implements \ArrayAccess, \Countable, IRequest {
$name = $this->server['SCRIPT_NAME'];
$overwriteWebRoot = $this->config->getSystemValue('overwritewebroot');
if ($overwriteWebRoot !== '' && $this->isOverwriteCondition()) {
// FIXME: This code is untestable due to ___DIR__
$serverRoot = str_replace('\\', '/', substr(__DIR__, 0, -strlen('lib/private/')));
// FIXME: This code is untestable due to __DIR__, also that hardcoded path is really dangerous
$serverRoot = str_replace('\\', '/', substr(__DIR__, 0, -strlen('lib/private/appframework/http/')));
$suburi = str_replace('\\', '/', substr(realpath($this->server['SCRIPT_FILENAME']), strlen($serverRoot)));
$name = '/' . ltrim($overwriteWebRoot . $suburi, '/');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment