Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When dealing with new config objects (or when using a lot of ignored elements), the $config array passed to \Drupal\config_update\ConfigDiffer::normalize() can be (or become) empty. That's throwing an annoying notice that can make some automated deployment tools fail.
Proposed resolution
Test if the array is empty before looping on its values or trying to sort it.
Remaining tasks
Patch, Review, Commit
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#2 | config_update_notice_normalize-2733257-2.patch | 1.04 KB | DuaelFr |
|
Comments
Comment #2
DuaelFrComment #3
jhodgdonThanks!
A much smaller patch would be something like adding, above the current stuff:
right?
Comment #4
DuaelFrThat's OK for me.
I'd prefer the readability of my version but I won't mind if you commit yours ;)
If $config === 0, FALSE or "" do we want to return an empty array or $config itself? I think the empty array is allright but you know better than me :)
Comment #5
jhodgdonWell, I think the return value is used as an array later on, so returning an empty array should be fine.
I'm wondering if we should add a test for this too?
Comment #7
jhodgdonSorry, forgot about this... I added the simple version of the patch, and decided it was OK not to add a test. Existing tests passed.
Comment #8
DuaelFr\o/ jhodgdon++