From 147c748793fdaa69b99071716ff7995c7af9cb2f Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Mon, 21 Oct 2024 11:34:00 -0700 Subject: [PATCH] Fixed #15933 --- CHANGELOG.md | 1 + src/db/Connection.php | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) 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();