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).
CommentFileSizeAuthor
#2 2113225-1-mail_logger-7.x-language.patch578 bytesalberto56
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alberto56’s picture

Status: Active » Needs work

Here is a patch which is not very elegant, but which at least prevents your site from breaking down, and still logs the message.

alberto56’s picture

Oops here it is.

fizk’s picture

Status: Needs work » Closed (duplicate)
alberto56’s picture

@fizk thanks, but you set this to be a duplicate of itself! If someone has the actual duplicate, please post it here.

Cheers,

Albert.

fizk’s picture

Thanks alberto, the duplicate was #1952880: PDOException: 'language' cannot be null :)