Skip to content

Commit adebc1d

Browse files
szaimenpabzm
andauthored
Apply suggestions from code review
Co-authored-by: Pablo Zmdl <57864086+pabzm@users.noreply.github.com> Signed-off-by: Simon L. <szaimen@e.mail.de>
1 parent 3b58af3 commit adebc1d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

php/src/Data/ConfigurationManager.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,11 +702,14 @@ private function writeConfig() : void {
702702
// original config is never touched until the new content is fully on disk.
703703
$tempFile = DataConst::GetConfigFile() . '.tmp';
704704
if (file_put_contents($tempFile, $content) === false) {
705-
@unlink($tempFile);
705+
// The file probably wasn't created, but better check nonetheless.
706+
if (file_exists($tempFile)) {
707+
unlink($tempFile);
708+
}
706709
throw new InvalidSettingConfigurationException("Failed to write temporary config file: " . $tempFile);
707710
}
708711
if (!rename($tempFile, DataConst::GetConfigFile())) {
709-
@unlink($tempFile);
712+
unlink($tempFile);
710713
throw new InvalidSettingConfigurationException("Failed to rename " . $tempFile . " to " . DataConst::GetConfigFile());
711714
}
712715
$this->config = [];

0 commit comments

Comments
 (0)