Warning: Undefined array key "override" in EmailBuilderManager.php).

Created on 12 January 2024, 11 months ago
Updated 5 February 2024, 11 months ago

Hi,

Thank you for this module. I've been using them for a long time. However, after upgrading from version '1.2.1' to '1.4.0', I have been receiving an error on admin/config/development/performance (after clearing the cache).

Warning: Undefined array key "override" in Drupal\symfony_mailer\Processor\EmailBuilderManager->processDefinition() (line 97 of modules/contrib/symfony_mailer/src/Processor/EmailBuilderManager.php).
Drupal\symfony_mailer\Processor\EmailBuilderManager->processDefinition(Array, 'adpomail') (Line: 287)
Drupal\Core\Plugin\DefaultPluginManager->findDefinitions() (Line: 204)
Drupal\symfony_mailer\Processor\EmailBuilderManager->findDefinitions() (Line: 175)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 92)
Drupal\symfony_mailer\Processor\MailerConfigOverride->buildCache() (Line: 52)
Drupal\symfony_mailer\Processor\MailerConfigOverride->loadOverrides(Array) (Line: 209)
Drupal\Core\Config\ConfigFactory->loadOverrides(Array) (Line: 169)
Drupal\Core\Config\ConfigFactory->doLoadMultiple(Array, 1) (Line: 104)
Drupal\Core\Config\ConfigFactory->doGet('core.extension') (Line: 89)
Drupal\Core\Config\ConfigFactory->get('core.extension') (Line: 70)
Drupal\Core\Extension\ThemeHandler->listInfo() (Line: 169)
block_rebuild()
call_user_func_array(Object, Array) (Line: 426)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'block') (Line: 405)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('rebuild', Object) (Line: 433)
Drupal\Core\Extension\ModuleHandler->invokeAll('rebuild') (Line: 579)
drupal_flush_all_caches() (Line: 192)
Drupal\system\Form\PerformanceForm->submitCacheClear(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 592)
Drupal\Core\Form\FormBuilder->processForm('system_performance_settings', Array, Object) (Line: 320)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 709)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Warning: Undefined array key "override" in Drupal\symfony_mailer\Processor\EmailBuilderManager->Drupal\symfony_mailer\Processor\{closure}() (line 215 of modules/contrib/symfony_mailer/src/Processor/EmailBuilderManager.php).
Drupal\symfony_mailer\Processor\EmailBuilderManager->Drupal\symfony_mailer\Processor\{closure}(Array)
array_filter(Array, Object) (Line: 216)
Drupal\symfony_mailer\Processor\EmailBuilderManager->findDefinitions() (Line: 175)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 92)
Drupal\symfony_mailer\Processor\MailerConfigOverride->buildCache() (Line: 52)
Drupal\symfony_mailer\Processor\MailerConfigOverride->loadOverrides(Array) (Line: 209)
Drupal\Core\Config\ConfigFactory->loadOverrides(Array) (Line: 169)
Drupal\Core\Config\ConfigFactory->doLoadMultiple(Array, 1) (Line: 104)
Drupal\Core\Config\ConfigFactory->doGet('core.extension') (Line: 89)
Drupal\Core\Config\ConfigFactory->get('core.extension') (Line: 70)
Drupal\Core\Extension\ThemeHandler->listInfo() (Line: 169)
block_rebuild()
call_user_func_array(Object, Array) (Line: 426)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'block') (Line: 405)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('rebuild', Object) (Line: 433)
Drupal\Core\Extension\ModuleHandler->invokeAll('rebuild') (Line: 579)
drupal_flush_all_caches() (Line: 192)
Drupal\system\Form\PerformanceForm->submitCacheClear(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 592)
Drupal\Core\Form\FormBuilder->processForm('system_performance_settings', Array, Object) (Line: 320)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 709)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Please note that there is noting special on line 287 in my custom module (just a comment // send admin email)

        $mail_service = \Drupal::service('plugin.manager.mail');

        // send admin email
        $config = \Drupal::config('admin_general_settings.settings');
        $proforma_emails = $config->get('proforma_emails');
        $proforma_emails_array = explode("\r\n", $proforma_emails);

        // $mail_admin_service = \Drupal::service('adpomail.mail_proforma');
        // $mail_admin_service->sendMail($params);
        $params = [
          'subject' => t('New Proforma Order - @number', ['@number' => $order_id]),
          'from' => $site_mail,
          'uid' => $uid,
          'order_id' => $order_id,
          'payment_gateway_label' =>  $entity->payment_gateway->first()->entity->label()
        ];
        $mail_service->mail(
          'adpomail', 
          'proforma_admin',
          $proforma_emails_array,
          $account->getPreferredLangcode(),
          $params,
          $site_mail,
          true
        );

I can only presume that some configurations were not imported during the update (I was using Symfony Mailer BC).

💬 Support request
Status

Fixed

Version

1.4

Component

Miscellaneous

Created by

🇵🇱Poland adpo

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @adpo
  • 🇵🇱Poland adpo

    Plaese note that the same warning: Undefined array key "override" in Drupal\symfony_mailer happens on register_no_approval_required

     Undefined array key "override" in Drupal\symfony_mailer\Processor\EmailBuilderManager->buildCache() (line 249 of modules/contrib/symfony_mailer/src/Processor/EmailBuilderManager.php).
    Drupal\symfony_mailer\Processor\EmailBuilderManager->buildCache() (Line: 157)
    Drupal\symfony_mailer\Processor\EmailBuilderManager->createInstanceFromMessage(Array) (Line: 88)
    Drupal\symfony_mailer\MailManagerReplacement->mail('user', 'register_no_approval_required', 'adrian_test2@test.com', 'en', Array, 'info@test.ie') (Line: 1070)
    _user_mail_notify('register_no_approval_required', Object) (Line: 116)
  • Status changed to Needs review 11 months ago
  • 🇬🇧United Kingdom adamps

    I think it is just a temporary problem relating to the upgrade. $definition['override'] will be set in the new version, but the code hasn't got far enough into loading the new version to discover that. I don't know why you see this and others don't.

    I guess if you apply to patch from #5, then it will work, and after if you remove the patch again, it will continue to work.

  • 🇵🇱Poland adpo

    Thank you both for quick response. Can you please also create a patch for: messageWarning: Undefined array key "override" in Drupal\symfony_mailer\Processor\EmailBuilderManager->Drupal\symfony_mailer\Processor\{closure}() (line 215

    here:

         $definitions = array_filter($definitions, function ($definition) {
            return !$definition['override'] || $this->overrideManager->isEnabled($definition['id']);
          });
  • Status changed to Fixed 11 months ago
  • 🇬🇧United Kingdom adamps

    It would be exactly the same fix in that case.

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

Production build 0.71.5 2024