What happened?
Description
Applying project config on a clean install can fail because pending config changes are sorted only by path depth. This can cause sections changes to be processed before related elementSources entries are fully constructed.
When that happens, section change handlers can read a partially-built elementSources config entry that contains nested values like defaultSort and tableAttributes, but is still missing scalar keys such as type. That results in:
Steps to reproduce
- See the linked pr test
Expected behavior
Project config should apply successfully on a clean install, without section change handlers observing partially-built elementSources configs.
Actual behavior
Project config application can fail on a clean install or fresh test database with:
In ElementSources.php line 147:
Undefined array key "type"
Craft CMS version
Craft CMS 5.9.17 (and bove)
PHP version
Operating system and version
Database type and version
Image driver and version
Installed plugins and versions
What happened?
Description
Applying project config on a clean install can fail because pending config changes are sorted only by path depth. This can cause
sectionschanges to be processed before relatedelementSourcesentries are fully constructed.When that happens, section change handlers can read a partially-built
elementSourcesconfig entry that contains nested values likedefaultSortandtableAttributes, but is still missing scalar keys such astype. That results in:Steps to reproduce
Expected behavior
Project config should apply successfully on a clean install, without section change handlers observing partially-built elementSources configs.
Actual behavior
Project config application can fail on a clean install or fresh test database with:
In ElementSources.php line 147:
Undefined array key "type"
Craft CMS version
Craft CMS 5.9.17 (and bove)
PHP version
Operating system and version
Database type and version
Image driver and version
Installed plugins and versions