dpi / avatars

Avatar Kit for Drupal
https://drupal.org/project/avatars
GNU General Public License v2.0
3 stars 2 forks source link

PHP message: TypeError: Return value of Drupal\avatars\Form\Entity\AvatarKitServiceForm::Drupal\avatars\Form\Entity\{closure}() must be of the type string, null returned #45

Open dsnopek opened 6 years ago

dsnopek commented 6 years ago

After installing avatars_gravatar (manually working around the composer issue here https://github.com/dpi/avatars_gravatar/issues/1), I get this error when clicking the "Add Service" button:

appserver_1  | [17-Jan-2018 20:34:20] WARNING: [pool www] child 128 said into stderr: "NOTICE: PHP message: TypeError: Return value of Drupal\avatars\Form\Entity\AvatarKitServiceForm::Drupal\avatars\Form\Entity\{closure}() must be of the type string, null returned in /app/web/modules/contrib/avatars/src/Form/Entity/AvatarKitServiceForm.php on line 75 #0 [internal function]: Drupal\avatars\Form\Entity\AvatarKitServiceForm->Drupal\avatars\Form\Entity\{closure}(Array)"
appserver_1  | [17-Jan-2018 20:34:20] WARNING: [pool www] child 128 said into stderr: "#1 /app/web/modules/contrib/avatars/src/Form/Entity/AvatarKitServiceForm.php(77): array_map(Object(Closure), Array)"
appserver_1  | [17-Jan-2018 20:34:20] WARNING: [pool www] child 128 said into stderr: "#2 [internal function]: Drupal\avatars\Form\Entity\AvatarKitServiceForm->buildForm(Array, Object(Drupal\Core\Form\FormState))"
appserver_1  | [17-Jan-2018 20:34:20] WARNING: [pool www] child 128 said into stderr: "#3 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(514): call_user_func_array(Array, Array)"
appserver_1  | [17-Jan-2018 20:34:20] WARNING: [pool www] child 128 said into stderr: "#4 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(271): Drupal\Core\Form\FormBuilder->retrieveForm('avatars_service...', Object(Drupal\Core\Form\FormState))"
appserver_1  | [17-Jan-2018 20:34:20] WARNING: [pool www] child 128 said into stderr: "#5 /app/web/core/lib/Drupal/Core/Controller/FormController.php(74): Drupal\Core\Form\FormBuilder->buildForm('avatars_service...', Object(Dr..."
dpi commented 6 years ago

Thats odd, each of the Gravatar services have a label. Issue not reproducible.

Next time it happens, check each entry of $definitions for an item without a 'label' key.

fidelix commented 6 years ago

Could be a bug in avatars_gravatar

$definitions:

array (
  'avatars_entity_field' => 
  array (
    'files' => true,
    'id' => 'avatars_entity_field',
    'label' => 
    Drupal\Core\StringTranslation\TranslatableMarkup::__set_state(array(
       'translatedMarkup' => NULL,
       'options' => 
      array (
      ),
       'stringTranslation' => NULL,
       'string' => 'Copy uploaded image',
       'arguments' => 
      array (
      ),
    )),
    'description' => 
    Drupal\Core\StringTranslation\TranslatableMarkup::__set_state(array(
       'translatedMarkup' => NULL,
       'options' => 
      array (
      ),
       'stringTranslation' => NULL,
       'string' => 'Copies an image uploaded to the entity.',
       'arguments' => 
      array (
      ),
    )),
    'class' => 'Drupal\\avatars\\Plugin\\Avatars\\Service\\AvatarKitEntityField',
    'provider' => 'avatars',
  ),
  'avatars_ak_common:gravatar_identicon' => 
  array (
    'class' => 'Drupal\\avatars_gravatar\\Plugin\\Avatars\\Service\\Gravatar',
    'config_dependencies' => 
    array (
      'module' => 
      array (
        0 => 'avatars_gravatar',
      ),
    ),
  ),
  'avatars_ak_common:gravatar_monster' => 
  array (
    'class' => 'Drupal\\avatars_gravatar\\Plugin\\Avatars\\Service\\Gravatar',
    'config_dependencies' => 
    array (
      'module' => 
      array (
        0 => 'avatars_gravatar',
      ),
    ),
  ),
  'avatars_ak_common:gravatar_mystery_man' => 
  array (
    'class' => 'Drupal\\avatars_gravatar\\Plugin\\Avatars\\Service\\Gravatar',
    'config_dependencies' => 
    array (
      'module' => 
      array (
        0 => 'avatars_gravatar',
      ),
    ),
  ),
  'avatars_ak_common:gravatar_retro' => 
  array (
    'class' => 'Drupal\\avatars_gravatar\\Plugin\\Avatars\\Service\\Gravatar',
    'config_dependencies' => 
    array (
      'module' => 
      array (
        0 => 'avatars_gravatar',
      ),
    ),
  ),
  'avatars_ak_common:gravatar_universal' => 
  array (
    'class' => 'Drupal\\avatars_gravatar\\Plugin\\Avatars\\Service\\Gravatar',
    'config_dependencies' => 
    array (
      'module' => 
      array (
        0 => 'avatars_gravatar',
      ),
    ),
  ),
  'avatars_ak_common:gravatar_wavatar' => 
  array (
    'class' => 'Drupal\\avatars_gravatar\\Plugin\\Avatars\\Service\\Gravatar',
    'config_dependencies' => 
    array (
      'module' => 
      array (
        0 => 'avatars_gravatar',
      ),
    ),
  ),
)