Error: __clone method called on non-object in Drupal\contact\MailHandler->sendMailMessages

Created on 12 December 2022, over 2 years ago
Updated 17 May 2025, 1 day ago

Problem/Motivation

Anonymous user cannot send a contact message due to an error

Steps to reproduce

Drupal version: 9.4.9, php version: 8.1.12, OS: Ubuntu 22.04
An anonymous user in /contact page types form contact and press "Send Message"
Result: Message was not sent
Error: __clone method called on non-object in Drupal\contact\MailHandler->sendMailMessages() (line 75 of core/modules/contact/src/MailHandler.php).
Drupal\contact\MailHandler->sendMailMessages() (Line: 223)
Drupal\contact\MessageForm->save()
call_user_func_array() (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 592)
Drupal\Core\Form\FormBuilder->processForm() (Line: 320)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm() (Line: 86)
Drupal\contact\Controller\ContactController->contactSitePage()
call_user_func_array() (Line: 123)
...

Proposed resolution

Patch attached

🐛 Bug report
Status

Postponed

Version

11.0 🔥

Component

contact.module

Created by

🇷🇺Russia ru.bsv Omsk

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024