Skip to content

Commit b5bbf39

Browse files
committed
Merge branch '4.x' into 4.15
2 parents 9efd014 + 67ba094 commit b5bbf39

File tree

9 files changed

+37
-8
lines changed

9 files changed

+37
-8
lines changed

CHANGELOG.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Release Notes for Craft CMS 4
22

3+
## 4.14.9 - 2025-02-25
4+
5+
- Added `craft\base\ElementTrait::$isNewSite`.
6+
- Added `craft\queue\jobs\PropagateElements::$isNewSite`.
7+
- Fixed an error that could occur when saving elements, if any dependencies defined global functions whose names conflicted with Yii’s built-in validator names, such as `string()`.
8+
- Fixed an error that could occur when applying field config changes if the field class didn’t exist.
9+
- Fixed a bug where `ancestors` and `parent` eager-loading wasn’t working on some environments. ([#16381](https://github.com/craftcms/cms/issues/16381), [#16382](https://github.com/craftcms/cms/issues/16382), [#16341](https://github.com/craftcms/cms/issues/16341))
10+
- Fixed a bug where asset, category, and tag relations weren’t propagating to newly-created sites for global sets. ([#16752](https://github.com/craftcms/cms/issues/16752))
11+
312
## 4.14.8.1 - 2025-02-20
413

514
- Fixed a bug where newly-created custom fields wouldn’t have their full settings intact for `afterSave()`.
@@ -128,7 +137,7 @@
128137

129138
- Fixed a bug where custom fields could cause validation errors when running the `users/create` command.
130139
- Fixed a bug where deleting a volume folder wasn’t fully deleting asset data in descendant folders.
131-
- Fixed a bug where `ancestors`, `children`, `descendants`, and `parent` eager-loading wasn’t working on some environments. ([#16381](https://github.com/craftcms/cms/issues/16381), [#16382](https://github.com/craftcms/cms/issues/16382))
140+
- Fixed a bug where `children` and `descendants` eager-loading wasn’t working on some environments. ([#16381](https://github.com/craftcms/cms/issues/16381), [#16382](https://github.com/craftcms/cms/issues/16382))
132141

133142
## 4.13.8 - 2025-01-02
134143

@@ -137,7 +146,7 @@
137146
- Fixed a bug where the password input on the Set Password page wasn’t including the “Show” button.
138147
- Fixed a SQL error that could occur if an element was saved with a title longer than 255 characters.
139148
- Fixed a bug where some UI messages began with a lowercase letter in some languages. ([#16354](https://github.com/craftcms/cms/issues/16354))
140-
- Fixed an RCE vulnerability.
149+
- Fixed an RCE vulnerability. ([CVE-2025-23209](https://www.cve.org/CVERecord?id=CVE-2025-23209))
141150

142151
## 4.13.7 - 2024-12-17
143152

src/base/Element.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ private static function _mapAncestors(array $sourceElements, bool $parents): ?ar
15621562
foreach ($elementStructureData as $elementStructureDatum) {
15631563
foreach ($ancestorStructureData as $ancestorStructureDatum) {
15641564
if (
1565-
$ancestorStructureDatum['structureId'] === $elementStructureDatum['structureId'] &&
1565+
$ancestorStructureDatum['structureId'] == $elementStructureDatum['structureId'] &&
15661566
$ancestorStructureDatum['lft'] < $elementStructureDatum['lft'] &&
15671567
$ancestorStructureDatum['rgt'] > $elementStructureDatum['rgt'] &&
15681568
(!$parents || $ancestorStructureDatum['level'] == $elementStructureDatum['level'] - 1)
@@ -2323,6 +2323,8 @@ public function attributes(): array
23232323
$names['propagating'],
23242324
$names['propagateAll'],
23252325
$names['newSiteIds'],
2326+
$names['isNewForSite'],
2327+
$names['isNewSite'],
23262328
$names['resaving'],
23272329
$names['duplicateOf'],
23282330
$names['mergingCanonicalChanges'],
@@ -2602,7 +2604,10 @@ private function _normalizeFieldValidator(string $attribute, mixed $rule, FieldI
26022604
array_unshift($rule, $attribute);
26032605
}
26042606

2605-
if (is_callable($rule[1]) || $field->hasMethod($rule[1])) {
2607+
if (
2608+
(!is_string($rule[1]) || !isset(Validator::$builtInValidators[$rule[1]])) &&
2609+
(is_callable($rule[1]) || $field->hasMethod($rule[1]))
2610+
) {
26062611
// InlineValidator assumes that the closure is on the model being validated
26072612
// so it won’t pass a reference to the element
26082613
$rule['params'] = [

src/base/ElementTrait.php

+6
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ trait ElementTrait
189189
*/
190190
public bool $isNewForSite = false;
191191

192+
/**
193+
* @var bool Whether this is for a newly-created site.
194+
* @since 4.14.9
195+
*/
196+
public bool $isNewSite = false;
197+
192198
/**
193199
* @var bool Whether the element is being resaved by a ResaveElement job or a `resave` console command.
194200
* @since 3.1.22

src/config/app.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
return [
44
'id' => 'CraftCMS',
55
'name' => 'Craft CMS',
6-
'version' => '4.14.8.1',
6+
'version' => '4.14.9',
77
'schemaVersion' => '4.15.0.0',
88
'minVersionRequired' => '3.7.11',
99
'basePath' => dirname(__DIR__), // Defines the @app alias

src/elements/User.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,7 @@ public function getPhoto(): ?Asset
16341634
}
16351635

16361636
/**
1637-
* Sets the entry’s author.
1637+
* Sets the user’s photo.
16381638
*
16391639
* @param Asset|null $photo
16401640
*/

src/fields/BaseRelationField.php

+1
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ public function normalizeValue(mixed $value, ?ElementInterface $element = null):
587587
$value instanceof ElementQueryInterface &&
588588
$element?->propagating &&
589589
$element->isNewForSite &&
590+
!$element->isNewSite &&
590591
!$this->targetSiteId &&
591592
!$this->showSiteMenu
592593
) {

src/queue/jobs/PropagateElements.php

+7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ class PropagateElements extends BaseBatchedJob
4141
*/
4242
public array|int|null $siteId = null;
4343

44+
/**
45+
* @var bool Whether this is for a newly-added site.
46+
* @since 4.14.9
47+
*/
48+
public bool $isNewSite = false;
49+
4450
/**
4551
* @inheritdoc
4652
*/
@@ -81,6 +87,7 @@ protected function processItem(mixed $item): void
8187
/** @var ElementInterface $item */
8288
$item->setScenario(Element::SCENARIO_ESSENTIALS);
8389
$item->newSiteIds = [];
90+
$item->isNewSite = $this->isNewSite;
8491
$supportedSiteIds = array_map(fn($siteInfo) => $siteInfo['siteId'], ElementHelper::supportedSitesForElement($item));
8592
$elementSiteIds = $this->siteId !== null ? array_intersect($this->siteId, $supportedSiteIds) : $supportedSiteIds;
8693
$elementsService = Craft::$app->getElements();

src/services/Fields.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,7 @@ public function applyFieldSave(string $fieldUid, array $data, string $context):
16061606
$oldColumnSuffix = !$isNewField ? $fieldRecord->getOldColumnSuffix() : null;
16071607
$newColumns = [];
16081608

1609-
if ($class::hasContentColumn()) {
1609+
if (class_exists($class) && $class::hasContentColumn()) {
16101610
$columnType = $data['contentColumnType'];
16111611

16121612
if (is_array($columnType)) {
@@ -1629,7 +1629,7 @@ public function applyFieldSave(string $fieldUid, array $data, string $context):
16291629
$db->getSchema()->refresh();
16301630

16311631
// don't drop the field content column if the field is missing
1632-
if (!$isNewField && $class !== MissingField::class) {
1632+
if (!$isNewField && class_exists($class) && $class !== MissingField::class) {
16331633
$this->_dropOldFieldColumns($oldHandle, $oldColumnSuffix, $newColumns);
16341634

16351635
if ($data['handle'] !== $oldHandle || ($data['columnSuffix'] ?? null) !== $oldColumnSuffix) {

src/services/Sites.php

+1
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ public function handleChangedSite(ConfigEvent $event): void
833833
'siteId' => $oldPrimarySiteId,
834834
],
835835
'siteId' => $site->id,
836+
'isNewSite' => true,
836837
]));
837838
}
838839
}

0 commit comments

Comments
 (0)