Skip to content

Commit

Permalink
Only use realpath for real directories (#26058)
Browse files Browse the repository at this point in the history
In some cross-local-storage use cases, the Local storage is
instantiated with "/" as data directory. In such cases, calling
realpath() would cause PHP warnings when open_basedir is set.

This fix bypasses the realpath() call when dealing with a root storage.
  • Loading branch information
Vincent Petry authored and DeepDiver1975 committed Sep 8, 2016
1 parent 9f31a81 commit 0751c2e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/private/Files/Storage/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ public function __construct($arguments) {
throw new \InvalidArgumentException('No data directory set for local storage');
}
$this->datadir = $arguments['datadir'];
$this->realDataDir = rtrim(realpath($this->datadir), '/') . '/';
// some crazy code uses a local storage on root...
if ($this->datadir === '/') {
$this->realDataDir = $this->datadir;
} else {
$this->realDataDir = rtrim(realpath($this->datadir), '/') . '/';
}
if (substr($this->datadir, -1) !== '/') {
$this->datadir .= '/';
}
Expand Down

0 comments on commit 0751c2e

Please sign in to comment.