Merge #15742 - remove double slash on TempDir

Pull-request: #15742
Closes: #15742
Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2020-01-06 23:03:37 +01:00
commit 4450bcec55
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
2 changed files with 34 additions and 1 deletions

View File

@ -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);
}

View File

@ -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
*