Hi, folks. I was tracking down an issue with Simplenews, and I believe Mail Logger was actually at fault. Please see #1951222: PDOException related to language and continue the conversation here.

Comments

areynolds’s picture

Title: Doesn't play well with Simplenews (ref: "PDOException related to language") » PDOException: 'language' cannot be null
Status: Active » Needs review
StatusFileSize
new707 bytes

Any mail that does not specify a language will cause this error; patch attached uses LANGUAGE_NONE when no language is specified to fix the issue.

Note that Mail Log presents an alternative to this module if you're having issues.

stephen verdant’s picture

StatusFileSize
new566 bytes

The first patch included git's color codes. Same patch without them...

fizk’s picture

Issue summary: View changes
Status: Needs review » Fixed

Fixed, thanks!

  • Commit 9c1c3e0 on 7.x-1.x by fizk:
    #1952880 areynolds, stephen Verdant: Set the email language if not...

Status: Fixed » Closed (fixed)

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

Talkless’s picture

Fixed? I still got error (in Drupal 7.31 using PHP 5.5.9-1ubuntu4.3):

    Warning: Attempt to assign property of non-object - mail_logger_mail_alter() (eilutė 68 iš /var/www/MYHOSTNAME/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] => emaillog_alert [:db_insert_placeholder_1] => vincas@MYHOSTNAME [:db_insert_placeholder_2] => [Some Name] Klaida: test error message [:db_insert_placeholder_3] => Site: http://MYHOSTNAME:8100 Severity: Klaida (3) Timestamp: 2014-08-29 19:12:24 Type: mymodulename IP Address: 192.168.0.1 Request URI: http://MYHOSTNAME:8100/ Referrer URI: http://MYHOSTNAME:8100/admin/reports/dblog User: Admin (1) Link: Message: test error message [:db_insert_placeholder_4] => info@MYHOSTNAME [: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:27:"info@MYHOSTNAME";s:6:"Sender";s:27:"info@MYHOSTNAME";s:4:"From";s:27:"info@MYHOSTNAME";} [:db_insert_placeholder_6] => 1409328743 [:db_insert_placeholder_7] => ) - mail_logger_mail_alter() (eilutė 81 iš /var/www/MYHOSTNAME/sites/all/modules/mail_logger/mail_logger.module).

I've just wrote watchdog() to check if emaillog will actually send email about new WATCHDOG_ERROR entry.

lachezar.valchev’s picture

Hi,

I can confirm that I still reproduce the error with Drupal 7.21 and the latest Mail Logger 7.x-dev from 2014-May-21.

Regards,
Lachezar

lachezar.valchev’s picture

Assigned: Unassigned » lachezar.valchev
Status: Closed (fixed) » Needs review
Issue tags: +PDOException language not null, +patch
StatusFileSize
new991 bytes

Hi,

Here is a patch to fix the issue.
From what I saw dumping the logger array it is probably changed now and it is the language is no longer at $logger['language']->language, but at $logger['language']

I suppose the $logger['language'] will always have the language, but just in case I left the IF check from the previous patch.

Regards,
Lachezar

Talkless’s picture

Hm, funny thing is, I do no know how to reproduce it. I cannot get error on clean Drupal installation, and I didn't applied any patch.

PascalAnimateur’s picture

I had the exact same problem when sending mail from the simplenews module and the patch from #8 fixed the issue. Thanks @graphityx

svarc’s picture

StatusFileSize
new1.1 KB

Its true what @graphityx is saying but there are still some cases where the $logger['language']->language is used instead of $logger['language'], this is the case for example with the webform module.
So here is an updated patch that will handle both situations.

  • fizk committed 5600d5c on 7.x-1.x
    Issue #1952880 by svarc, graphityx, stephen Verdant, areynolds: Properly...
fizk’s picture

Status: Needs review » Fixed

Committed, thanks!

fizk’s picture

Assigned: lachezar.valchev » Unassigned

Status: Fixed » Closed (fixed)

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