backdrop-contrib / socialfield

The Social field module provides a field that allows you to collect links to social network profiles like facebook, twitter, google+, linkedin, etc.
GNU General Public License v2.0
2 stars 4 forks source link

Fatal: Type error #20

Closed laryn closed 3 months ago

laryn commented 9 months ago

I tried to activate this module and got this:

TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in array_keys() (line 101 of /var/www/html/modules/contrib/socialfield/socialfield.module).

laryn commented 9 months ago

This may be a special case -- an upgrade from a Drupal 7 site where I had neglected to copy this module over during the upgrade. Afterwards I copied the module over and enabled it, and it was trying to load the configuration but there was none.

In any event, I have now imported the default configuration manually through the UI and am testing further.

laryn commented 9 months ago

Hmm... then later I was prompted to run the upgrade for socialfield and it crashed the site again until I did a config sync on the command line with bee.

TypeError: array_keys(): Argument #1 ($array) must be of type array, string given in array_keys() (line 101 of /var/www/html/modules/contrib/socialfield/socialfield.module).

laryn commented 9 months ago

@jenlampton If you're open to some defensive coding here, I've added a PR.

laryn commented 9 months ago

I will be revising the PR -- the next time I tried to run this upgrade with the first version I got further but then ran into:

StatusText: error ResponseText: ValueError: array_combine(): Argument #1 ($keys) and argument #2 ($values) must have the same number of elements in array_combine() (line 109 of /var/www/html/modules/contrib/socialfield/socialfield.module).

laryn commented 9 months ago

@jenlampton I added a failsafe value to this array in the case that it was returning nothing, and then was able to complete the upgrade from Drupal 7 locally without a fatal error.