diff --git a/CHANGELOG.md b/CHANGELOG.md index b4c9fb4246f..eedc9d1840e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Release Notes for Craft CMS 5 +## Unreleased + +- Fixed an error that could occur if an invalid folder ID was passed to `craft\services\Assets::deleteFoldersByIds()`. ([#16147](https://github.com/craftcms/cms/pull/16147)) +- Fixed a SQL error that occurred when creating a new Single section. ([#16145](https://github.com/craftcms/cms/issues/16145)) +- Fixed an RCE vulnerability. + ## 5.5.1.1 - 2024-11-18 - Fixed a PHP error. ([#16142](https://github.com/craftcms/cms/issues/16142)) diff --git a/bootstrap/bootstrap.php b/bootstrap/bootstrap.php index bc2a5fb15ba..f43726fb304 100644 --- a/bootstrap/bootstrap.php +++ b/bootstrap/bootstrap.php @@ -27,8 +27,15 @@ // Determine the paths // ----------------------------------------------------------------------------- -$findConfig = function(string $cliName, string $envName) { - return App::cliOption($cliName, true) ?? App::env($envName); +$findConfig = function(string $cliName, string $envName) use ($appType) { + if ($appType === 'console') { + $value = App::cliOption($cliName, true); + if ($value !== null) { + return $value; + } + } + + return App::env($envName); }; // Set the vendor path. By default assume that it's 4 levels up from here @@ -49,11 +56,7 @@ // Set the environment // ----------------------------------------------------------------------------- -$environment = App::cliOption('--env', true) - ?? App::env('CRAFT_ENVIRONMENT') - ?? App::env('ENVIRONMENT') - ?? $_SERVER['SERVER_NAME'] - ?? null; +$environment = $findConfig('--env', 'CRAFT_ENVIRONMENT') ?? App::env('ENVIRONMENT') ?? $_SERVER['SERVER_NAME'] ?? null; // Load the general config // ----------------------------------------------------------------------------- diff --git a/src/services/Assets.php b/src/services/Assets.php index 033b43092a1..39728cd6545 100644 --- a/src/services/Assets.php +++ b/src/services/Assets.php @@ -312,9 +312,13 @@ public function deleteFoldersByIds(int|array $folderIds, bool $deleteDir = true) foreach ((array)$folderIds as $folderId) { $folder = $this->getFolderById((int)$folderId); + if (!$folder) { + continue; + } + $folders[] = $folder; - if ($folder && $deleteDir) { + if ($folder->path && $deleteDir) { $volume = $folder->getVolume(); try { $volume->deleteDirectory($folder->path); diff --git a/src/services/Entries.php b/src/services/Entries.php index fdc756a0522..dbeac9218be 100644 --- a/src/services/Entries.php +++ b/src/services/Entries.php @@ -43,7 +43,6 @@ use craft\models\Structure; use craft\queue\jobs\ApplyNewPropagationMethod; use craft\queue\jobs\ResaveElements; -use craft\records\Entry as EntryRecord; use craft\records\EntryType as EntryTypeRecord; use craft\records\Section as SectionRecord; use craft\records\Section_SiteSettings as Section_SiteSettingsRecord; @@ -979,7 +978,7 @@ private function _ensureSingleEntry(Section $section, ?array $siteSettings = nul if ($entry === null) { $entry = $baseEntryQuery ->trashed(null) - ->where([EntryRecord::tableName() . '.[[deletedWithEntryType]]' => 1]) + ->where(['entries.deletedWithEntryType' => true]) ->one(); if ($entry !== null) {