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.
I installed the domain_locale module and one of my domains didin't have a default language. When using the domain_locale_language_default function, I got a fatal error object to string conversion.
The following code returned a language object instead of a string
global $_domain;
$domain_language_default = domain_conf_variable_get($_domain['domain_id'], 'language_default');
Normally the variable $domain_language_default is used to query the database but because this was already a language object this was not possible.
Comment | File | Size | Author |
---|---|---|---|
#12 | domain_locale_default_lang_2118303_12.patch | 745 bytes | vasi1186 |
#11 | domain_locale_default_lang_2118303.patch | 530 bytes | a.milkovsky |
Comments
Comment #1
Mac_Weber CreditAttribution: Mac_Weber commentedI think this error is already fixed on the newest versions. At installation time it will set the default language.
In which line of the module this error is happening? According to the documentation of
domain_conf_variable_get
it should return a string or NULL, even in case of a bug not setting the default language.Comment #2
JeroenTI tried to reproduce this behaviour with a clean drupal installation, but it was not possible, so I guess it's already fixed then.
Comment #3
Mac_Weber CreditAttribution: Mac_Weber commentedThank you for the feedback Jeroen!
Comment #4
dgastudio CreditAttribution: dgastudio commentedno, it's still exists.
to reproduce:
domain acces, domain locale.
add any language.
admin/config/regional/language
save
Recoverable fatal error: Object of class stdClass could not be converted to string en DatabaseStatementBase->execute() (línea 2167 de /home/u7394/domains/*********/includes/database/database.inc).
after disable the module, everything works fine again.
Comment #5
nonsieAs always, which versions are you using?
Comment #6
dgastudio CreditAttribution: dgastudio commentedthe issue is about dev version, no?
Comment #7
nonsieWhich version of Domain Access?
Comment #8
dgastudio CreditAttribution: dgastudio commentedversion = "7.x-3.11"
Comment #9
roeldl CreditAttribution: roeldl commentedThe problem occurs when you change your default language under admin/config/regional/language without assigning a default language under your domain languages settings.
Comment #10
Mac_Weber CreditAttribution: Mac_Weber commented@roeldl, the instructions of the module says to not use that page to assign the default language. The latest -dev version also fixes it by not allowing admin to do it at said page. See #2011804: Allow admins to enable/disable languages ONLY for specific domains.
Comment #11
a.milkovskyIssue is not resolved. I still receive:
Next patch fixes the issue
Comment #12
vasi1186 CreditAttribution: vasi1186 at Amazee Labs commentedThe above patch introduced another bug: when you tried to access the domain with a language that was not assigned to it, the redirect to the default language was not performed. The reason is that the
$domain_language_default
was a string and not an object.I attached a new patch that should fix both issues.
Comment #14
Mac_Weber CreditAttribution: Mac_Weber as a volunteer commentedComitted last patch.