Skip to content

Commit

Permalink
Filter out field layouts for invalid element types
Browse files Browse the repository at this point in the history
Fixes #16352
  • Loading branch information
brandonkelly committed Dec 27, 2024
1 parent 4827b24 commit 0265805
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Fixed a bug where custom fields were getting included in rendered field layout forms, even if their `getInputHtml()` method returned an empty string.
- Fixed a bug where the password input on the Set Password page wasn’t including the “Show” button.
- Fixed a SQL error that could occur if an element was saved with a title longer than 255 characters.
- Fixed errors that could occur when working with field layouts for element types that are no longer installed. ([#16352](https://github.com/craftcms/cms/issues/16352))
- Fixed an RCE vulnerability.

## 4.13.7 - 2024-12-17
Expand Down
5 changes: 4 additions & 1 deletion src/services/Fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,10 @@ private function _layouts(): MemoizableArray
{
if (!isset($this->_layouts)) {
if (Craft::$app->getIsInstalled()) {
$layoutConfigs = $this->_createLayoutQuery()->all();
$layoutConfigs = $this->_createLayoutQuery()->collect()
->filter(fn(array $config) => ComponentHelper::validateComponentClass($config['type'], ElementInterface::class))
->values()
->all();
$layoutTabConfigs = ArrayHelper::index($this->_createLayoutTabQuery()->all(), null, ['layoutId']);
} else {
$layoutConfigs = [];
Expand Down

0 comments on commit 0265805

Please sign in to comment.