Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This has happened to me when using mail_logger in conjuction with the Simplenews mechanism which sends confirmation email to prospective users, possibly having to do with the site being multilingual.
Notice: Trying to get property of non-object in mail_logger_mail_alter() (line 113 of /Applications/MAMP/htdocs/drupal7sandbox/sites/all/modules/mail_logger/mail_logger.module).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'language' cannot be null: INSERT INTO {mail_logger} (mailkey, mailto, subject, body, mailfrom, headers, date_sent, language) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => simplenews_subscribe [:db_insert_placeholder_1] => spam@example.com [:db_insert_placeholder_2] => Confirmation for Drupal newsletter from test [:db_insert_placeholder_3] => We have received a request to subscribe spam@example.com to the Drupal newsletter newsletter on test website at http://localhost/drupal7sandbox/. To confirm please use the link below. http://localhost/drupal7sandbox/newsletter/confirm/add/4f7dad1b751t1 [:db_insert_placeholder_4] => a@aa.a [:db_insert_placeholder_5] => a:7:{s:12:"MIME-Version";s:3:"1.0";s:12:"Content-Type";s:51:"text/plain; charset=UTF-8; format=flowed; delsp=yes";s:25:"Content-Transfer-Encoding";s:4:"8Bit";s:8:"X-Mailer";s:6:"Drupal";s:11:"Return-Path";s:6:"a@aa.a";s:6:"Sender";s:6:"a@aa.a";s:4:"From";s:15:""test" <a@aa.a>";} [:db_insert_placeholder_6] => 1381934211 [:db_insert_placeholder_7] => ) in mail_logger_mail_alter() (line 115 of /Applications/MAMP/htdocs/drupal7sandbox/sites/all/modules/mail_logger/mail_logger.module).
Comment | File | Size | Author |
---|---|---|---|
#2 | 2113225-1-mail_logger-7.x-language.patch | 578 bytes | alberto56 |
Comments
Comment #1
alberto56 CreditAttribution: alberto56 commentedHere is a patch which is not very elegant, but which at least prevents your site from breaking down, and still logs the message.
Comment #2
alberto56 CreditAttribution: alberto56 commentedOops here it is.
Comment #3
fizk CreditAttribution: fizk commentedDuplicate of #1952880: PDOException: 'language' cannot be null.
Comment #4
alberto56 CreditAttribution: alberto56 commented@fizk thanks, but you set this to be a duplicate of itself! If someone has the actual duplicate, please post it here.
Cheers,
Albert.
Comment #5
fizk CreditAttribution: fizk commentedThanks alberto, the duplicate was #1952880: PDOException: 'language' cannot be null :)