Skip to content

Commit dc9b9a1

Browse files
author
Willem de Groot
committed
Get realpath for DOCUMENT_ROOT to support symlinking
1 parent b221e80 commit dc9b9a1

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

app/code/Magento/Sitemap/Model/Sitemap.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ protected function _getFormattedLastmodDate($date)
630630
*/
631631
protected function _getDocumentRoot()
632632
{
633-
return $this->_request->getServer('DOCUMENT_ROOT');
633+
return realpath($this->_request->getServer('DOCUMENT_ROOT'));
634634
}
635635

636636
/**

lib/internal/Magento/Framework/App/SetupInfo.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function __construct($server, $projectRoot = '')
5959
if (empty($server['DOCUMENT_ROOT'])) {
6060
throw new \InvalidArgumentException('DOCUMENT_ROOT variable is unavailable.');
6161
}
62-
$this->docRoot = rtrim(str_replace('\\', '/', $server['DOCUMENT_ROOT']), '/');
62+
$this->docRoot = rtrim(str_replace('\\', '/', realpath($server['DOCUMENT_ROOT'])), '/');
6363
$this->projectRoot = $projectRoot ?: $this->detectProjectRoot();
6464
$this->projectRoot = str_replace('\\', '/', $this->projectRoot);
6565
}

pub/errors/processor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ protected function _getIndexDir()
301301
{
302302
$documentRoot = '';
303303
if (!empty($_SERVER['DOCUMENT_ROOT'])) {
304-
$documentRoot = rtrim($_SERVER['DOCUMENT_ROOT'], '/');
304+
$documentRoot = rtrim(realpath($_SERVER['DOCUMENT_ROOT']), '/');
305305
}
306306
return dirname($documentRoot . $this->_scriptName) . '/';
307307
}

0 commit comments

Comments
 (0)