diff --git a/CHANGELOG.md b/CHANGELOG.md index e17759f9d9d..2a4e79928aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Fixed a bug where admin table header cells weren’t indicating when they were sorted. ([#15897](https://github.com/craftcms/cms/issues/15897)) +- Fixed an error that occurred when creating a database backup, if the System Name contained any quote-like characters. ([#15933](https://github.com/craftcms/cms/issues/15933)) ## 4.12.7 - 2024-10-15 diff --git a/src/db/Connection.php b/src/db/Connection.php index e545db00f71..0268946103f 100644 --- a/src/db/Connection.php +++ b/src/db/Connection.php @@ -203,9 +203,10 @@ public function close(): void public function getBackupFilePath(): string { // Determine the backup file path - $systemName = mb_strtolower(FileHelper::sanitizeFilename(Craft::$app->getSystemName(), [ + $systemName = FileHelper::sanitizeFilename(Craft::$app->getSystemName(), [ 'asciiOnly' => true, - ])); + ]); + $systemName = str_replace(['\'', '"'], '', strtolower($systemName)); $version = Craft::$app->getInfo()->version ?? Craft::$app->getVersion(); $filename = ($systemName ? "$systemName--" : '') . gmdate('Y-m-d-His') . "--v$version"; $backupPath = Craft::$app->getPath()->getDbBackupPath();