diff --git a/CHANGELOG.md b/CHANGELOG.md index d8beccf0b7a..60ce4948d3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Release Notes for Craft CMS 4 -## Unreleased +## 4.12.1 - 2024-09-06 - Added `craft\services\Security::isSystemDir()`. - Fixed a bug where `craft\helpers\StringHelper::lines()` was returning an array of `Stringy\Stringy` objects, rather than strings. @@ -8,6 +8,7 @@ - Fixed a validation error that could occur when saving a relational field, if the “Maintain hierarchy” setting had been enabled but was no longer applicable. ([#15666](https://github.com/craftcms/cms/issues/15666)) - Fixed a bug where formatted addresses weren’t using the application locale consistently. ([#15668](https://github.com/craftcms/cms/issues/15668)) - Fixed a bug where Tip and Warning field layout UI elements would display in field layouts even if they had no content. ([#15681](https://github.com/craftcms/cms/issues/15681)) +- Fixed an error that could occur when reverting an element’s content from a revision, if the element had been added to additional sites since the time the revision was created. ([#15679](https://github.com/craftcms/cms/issues/15679)) - Fixed an information disclosure vulnerability. ## 4.12.0 - 2024-09-03 diff --git a/src/config/app.php b/src/config/app.php index 76afb930beb..a0f39ce8c35 100644 --- a/src/config/app.php +++ b/src/config/app.php @@ -3,7 +3,7 @@ return [ 'id' => 'CraftCMS', 'name' => 'Craft CMS', - 'version' => '4.12.0', + 'version' => '4.12.1', 'schemaVersion' => '4.5.3.0', 'minVersionRequired' => '3.7.11', 'basePath' => dirname(__DIR__), // Defines the @app alias diff --git a/src/services/Elements.php b/src/services/Elements.php index 0166958ea54..71179d82539 100644 --- a/src/services/Elements.php +++ b/src/services/Elements.php @@ -3668,7 +3668,11 @@ private function _propagateElement( $siteElement->siteSettingsId = null; $siteElement->contentId = null; $siteElement->setEnabledForSite($siteInfo['enabledByDefault']); - $siteElement->isNewForSite = true; + // set isNewForSite to true unless we're reverting content from a revision + // in which case, it's possible that the canonical element exists for the site already, + // but didn't back when the revision was created. + // (see https://github.com/craftcms/cms/issues/15679) + $siteElement->isNewForSite = !$siteElement->duplicateOf?->getIsRevision(); // Keep track of this new site ID $element->newSiteIds[] = $siteInfo['siteId'];