summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-02-16 16:26:02 +0100
committerLukas Reschke <lukas@owncloud.com>2015-02-16 22:13:01 +0100
commit992164446cf7da39078d879300475b6353e1d40f (patch)
tree6df581f39b6c61cc2e0199c8411bd7b5d1e53648 /lib
parent9f91d64918f70002ec5043613f83694137c2d9ee (diff)
downloadnextcloud-server-992164446cf7da39078d879300475b6353e1d40f.tar.gz
nextcloud-server-992164446cf7da39078d879300475b6353e1d40f.zip
Add blackmagic due to cyclic dependency :see_no_evil:
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php9
-rw-r--r--lib/private/appframework/http/request.php6
2 files changed, 11 insertions, 4 deletions
diff --git a/lib/base.php b/lib/base.php
index 51d59d130aa..5905aa0406f 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -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
diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php
index 97e9809c1fb..5cffbccb623 100644
--- a/lib/private/appframework/http/request.php
+++ b/lib/private/appframework/http/request.php
@@ -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, '/');
}