What happened?
Description
I merged in project configuration updates from an upstream Git remote and ran craft project-config/apply (also with --force).
Steps to reproduce
- There was a section + "default" entry that was removed. A file
config/project/sections/breadcrumb--d54234c7-a770-4ac4-b2f4-44454981c1cd.yaml was deleted. Also the file config/project/entryTypes/default--3a0616a9-c476-495e-a3e3-cd63070ae266.yaml for the default entry type was deleted.
- I ran
craft project-config/apply and got an error.
Expected behavior
Project config updates get applied without error
Actual behavior
I got an error:
- updating sections.d54234c7-a770-4ac4-b2f4-44454981c1cd ...
error: Trying to access array offset on value of type null
The UID matches that of the deleted section.
From the logs:
2022-10-20 10:51:17 [console.ERROR] [yii\base\ErrorException:2] yii\base\ErrorException: Trying to access array offset on value of type null in vendor/craftcms/cms/src/services/Sections.php:585
Stack trace:
#0 {main} {"memory":26866048,"exception":"[object] (yii\\base\\ErrorException(code: 2): Trying to access array offset on value of type null at vendor/craftcms/cms/src/services/Sections.php:585)"}
In src/services/Sections.php line 585 a craft\events\ConfigEvent is being handled by handleChangedSection(). The error occurs on this line:
|
$siteSettingData = $data['siteSettings']; |
There
$data is
null.
The event that is being fired is:
object(craft\events\ConfigEvent)#482 (7) {
["name"]=>
string(10) "updateItem"
["sender"]=>
object(craft\events\ConfigEvent) ......
["handled"]=>
bool(false)
["data"]=>
NULL
["path"]=>
string(45) "sections.d54234c7-a770-4ac4-b2f4-44454981c1cd"
["oldValue"]=>
NULL
["newValue"]=>
NULL
["tokenMatches"]=>
array(1) {
[0]=>
string(36) "d54234c7-a770-4ac4-b2f4-44454981c1cd"
}
}
Shouldn't this part also handle deletions correctly?
Craft CMS version
4.2.5.2
PHP version
8.1.0
Operating system and version
Debian GNU/Linux 11 (bullseye)
Database type and version
5.5.5-10.5.12-MariaDB-1
Image driver and version
?
Installed plugins and versions
- craftcms/cms 4.2.5.2
- craftcms/element-api 3.0.1.1
- craftcms/feed-me 5.0.4
- craftcms/html-field 2.0.5
- craftcms/oauth2-craftid 1.0.0.1
- craftcms/plugin-installer 1.5.7
- craftcms/redactor 3.0.2
- craftcms/server-check 2.1.4
- verbb/formie 2.0.12
What happened?
Description
I merged in project configuration updates from an upstream Git remote and ran
craft project-config/apply(also with--force).Steps to reproduce
config/project/sections/breadcrumb--d54234c7-a770-4ac4-b2f4-44454981c1cd.yamlwas deleted. Also the fileconfig/project/entryTypes/default--3a0616a9-c476-495e-a3e3-cd63070ae266.yamlfor the default entry type was deleted.craft project-config/applyand got an error.Expected behavior
Project config updates get applied without error
Actual behavior
I got an error:
The UID matches that of the deleted section.
From the logs:
In src/services/Sections.php line 585 a
craft\events\ConfigEventis being handled byhandleChangedSection(). The error occurs on this line:cms/src/services/Sections.php
Line 585 in 3c16404
There
$dataisnull.The event that is being fired is:
Shouldn't this part also handle deletions correctly?
Craft CMS version
4.2.5.2
PHP version
8.1.0
Operating system and version
Debian GNU/Linux 11 (bullseye)
Database type and version
5.5.5-10.5.12-MariaDB-1
Image driver and version
?
Installed plugins and versions