Skip to content

Commit f0fee32

Browse files
committed
Fixed #16659
1 parent 7e95638 commit f0fee32

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Fixed a bug where user addresses weren’t getting restored when soft-deleted users were restored. ([#16636](https://github.com/craftcms/cms/pull/16636))
1212
- Fixed a bug where pressing the “New entry” button multiple times quickly would create multiple nested entries, circumventing the “Max Entries” settings. ([#16642](https://github.com/craftcms/cms/issues/16642))
1313
- Fixed a bug where Link fields without values were always getting marked as dirty when making another change to the element. ([#16649](https://github.com/craftcms/cms/pull/16649))
14+
- Fixed an error that could occur when programmatically duplicating a nested element for a new site. ([#16659](https://github.com/craftcms/cms/issues/16659))
1415
- Fixed a potential phishing attack vector.
1516
- Fixed a styling issue.
1617

src/base/NestedElementTrait.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,26 @@ public static function eagerLoadingMap(array $sourceElements, string $handle): a
105105
public bool $updateSearchIndexForOwner = false;
106106

107107
/**
108-
* @var ElementInterface|false The primary owner element, or false if [[primaryOwnerId]] is invalid
108+
* @var ElementInterface|false|null The primary owner element, or false if [[primaryOwnerId]] is invalid
109109
* @see getPrimaryOwner()
110110
* @see setPrimaryOwner()
111111
*/
112-
private ElementInterface|false $_primaryOwner;
112+
private ElementInterface|false|null $_primaryOwner = null;
113113

114114
/**
115-
* @var ElementInterface|false The owner element, or false if [[ownerId]] is invalid
115+
* @var ElementInterface|false|null The owner element, or false if [[ownerId]] is invalid
116116
* @see getOwner()
117117
* @see setOwner()
118118
*/
119-
private ElementInterface|false $_owner;
119+
private ElementInterface|false|null $_owner = null;
120+
121+
public function __clone(): void
122+
{
123+
parent::__clone();
124+
125+
$this->_primaryOwner = null;
126+
$this->_owner = null;
127+
}
120128

121129
/**
122130
* @inheritdoc

0 commit comments

Comments
 (0)