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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DuaelFr created an issue. See original summary.

DuaelFr’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
1.04 KB
jhodgdon’s picture

Status: Needs review » Needs work

Thanks!

A much smaller patch would be something like adding, above the current stuff:

if (empty($config)) {
  return [];
}

right?

DuaelFr’s picture

That'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 :)

jhodgdon’s picture

Well, 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?

  • jhodgdon committed 09e639d on 8.x-1.x
    Issue #2733257 by DuaelFr, jhodgdon: Remove annoying notice when dealing...
jhodgdon’s picture

Status: Needs work » Fixed

Sorry, forgot about this... I added the simple version of the patch, and decided it was OK not to add a test. Existing tests passed.

DuaelFr’s picture

\o/ jhodgdon++

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.