1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-13 04:04:12 +02:00

[ticket/16639] Pass absolute paths to make_path_relative

PHPBB3-16639
This commit is contained in:
rubencm
2020-12-07 15:10:26 +01:00
parent c6a202bdb3
commit 3a5a19bd99
4 changed files with 9 additions and 7 deletions

View File

@@ -230,8 +230,9 @@ class local implements adapter_interface, stream_interface
*/
protected function ensure_directory_exists($path)
{
$path = dirname($this->root_path . $this->get_path($path) . $this->get_filename($path));
$path = filesystem_helper::make_path_relative($path, $this->root_path);
$absolute_root_path = filesystem_helper::realpath($this->root_path) . DIRECTORY_SEPARATOR;
$path = dirname($absolute_root_path . $this->get_path($path) . $this->get_filename($path));
$path = filesystem_helper::make_path_relative($path, $absolute_root_path);
if (!$this->exists($path))
{
@@ -254,11 +255,11 @@ class local implements adapter_interface, stream_interface
do
{
$parts = explode('/', $path);
$parts = explode(DIRECTORY_SEPARATOR, $path);
$parts = array_slice($parts, 0, -1);
$path = implode('/', $parts);
$path = implode(DIRECTORY_SEPARATOR, $parts);
}
while ($path && @rmdir($dirpath . '/' . $path));
while ($path && @rmdir($dirpath . DIRECTORY_SEPARATOR . $path));
}
}