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.
Fix Recoverable fatal error: Object of class stdClass could not be converted to string in _variable_store_load()
my proposal
// Fix SmtpMailSystem::mailWithoutQueue(...) with i18n_variable_get(...)
diff --git a/sites/all/modules/contrib/smtp/smtp.mail.inc b/sites/all/modules/contrib/smtp/smtp.mail.inc
index d4d0ba4..fb2ee3d 100644
--- a/sites/all/modules/contrib/smtp/smtp.mail.inc
+++ b/sites/all/modules/contrib/smtp/smtp.mail.inc
@@ -81,15 +81,17 @@ class SmtpMailSystem implements MailSystemInterface {
// of the email being sent.
$from_name = FALSE;
if (function_exists('i18n_variable_get')) {
- if (i18n_variable_get('smtp_fromname', $message['language'], '') != '') {
- $from_name = i18n_variable_get('smtp_fromname', $message['language'], '');
+ // Fix Recoverable fatal error: Object of class stdClass could not be converted to string
+ $langcode = isset($message['language']->language) ? $message['language']->language : language_default('language');
+ if (i18n_variable_get('smtp_fromname', $langcode, '') != '') {
+ $from_name = i18n_variable_get('smtp_fromname', $langcode, '');
}
else {
// If value is not defined in settings, use site_name.
- $from_name = i18n_variable_get('site_name', $message['language'], '');
+ $from_name = i18n_variable_get('site_name', $langcode, '');
}
}
-
+
if (variable_get('smtp_client_hostname', '') != '') {
$mailer->Hostname = variable_get('smtp_client_hostname', '');
}
Comment | File | Size | Author |
---|---|---|---|
#3 | smtp-and-i18n-node-2731417.patch | 1.26 KB | mario.ugedo |
Comments
Comment #2
mario.ugedo CreditAttribution: mario.ugedo commentedComment #3
mario.ugedo CreditAttribution: mario.ugedo commentedHello!
the patch to fix Recoverable fatal error: Object of class stdClass could not be converted to string in _variable_store_load() (sites/all/modules/contrib/variable/variable_store/variable_store.module).
smtp-and-i18n-node-2731417.patch
Comment #4
wundo CreditAttribution: wundo at Chuva Inc. for Chuva Inc. commentedDuplicated of #2720015: Fatal error when sending emails
Comment #5
apaderno