diff --git a/libraries/classes/Config.php b/libraries/classes/Config.php index 4ba9cbdb9a..675296033b 100644 --- a/libraries/classes/Config.php +++ b/libraries/classes/Config.php @@ -1673,7 +1673,7 @@ class Config if (empty($path)) { $path = null; } else { - $path .= '/' . $name; + $path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name; if (! @is_dir($path)) { @mkdir($path, 0770, true); } diff --git a/test/classes/ConfigTest.php b/test/classes/ConfigTest.php index f32f9005d0..be234167ce 100644 --- a/test/classes/ConfigTest.php +++ b/test/classes/ConfigTest.php @@ -1007,6 +1007,39 @@ class ConfigTest extends PmaTestCase ); } + /** + * Test for getTempDir + * + * @return void + * + * @group file-system + */ + public function testGetTempDir(): void + { + $this->object->set('TempDir', sys_get_temp_dir() . DIRECTORY_SEPARATOR); + // Check no double slash is here + $this->assertEquals( + sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'upload', + $this->object->getTempDir('upload') + ); + } + + /** + * Test for getUploadTempDir + * + * @return void + * + * @group file-system + */ + public function testGetUploadTempDir(): void + { + $this->object->set('TempDir', sys_get_temp_dir() . DIRECTORY_SEPARATOR); + $this->assertEquals( + $this->object->getTempDir('upload'), + $this->object->getUploadTempDir() + ); + } + /** * Test for isGitRevision *