craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.22k stars 626 forks source link

[4.x]: Creating/saving section: Getting unknown property: craft\events\SectionEvent::element #14528

Closed elfacht closed 6 months ago

elfacht commented 6 months ago

What happened?

Description

When saving an existing or creating a new single type section, an exception occurs on save:

Unknown Property – [yii\base\UnknownPropertyException](https://www.yiiframework.com/doc-2.0/yii-base-unknownpropertyexception.html)
Getting unknown property: craft\events\SectionEvent::element

Screen shot 2024-03-05 um 12 13 41

Steps to reproduce

  1. Create or edit a section that is type single: Screen shot 2024-03-05 um 12 13 28
  2. Enter any values or use empty values.
  3. Save

Saving an existing type with this YAML settings will cause the exception as well:

defaultPlacement: end
enableVersioning: true
handle: adminSettings
name: 'Admin Settings'
previewTargets:
  -
    __assoc__:
      -
        - label
        - 'Primary entry page'
      -
        - urlFormat
        - '{url}'
      -
        - refresh
        - '1'
propagationMethod: all
siteSettings:
  0f9c8122-f788-42eb-863a-2eb5a20b804c: # $SYSTEM_NAME
    enabledByDefault: false
    hasUrls: false
    template: null
    uriFormat: null
type: single

Expected behavior

Saving the section would show me an success message and the created section.

Actual behavior

An exception occurs and the section would not be saved.

Craft CMS version

4.7.4

PHP version

8.2.16

Operating system and version

Linux 6.6.12-linuxkit

Database type and version

MySQL 5.7.42 / MySQL 8.0.36

Image driver and version

Imagick 3.7.0

Installed plugins and versions

elfacht commented 6 months ago

Right after creating this issue we found out that this is an individual issue caused by a custom plugin.