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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Mac_Weber’s picture

I think this error is already fixed on the newest versions. At installation time it will set the default language.

  1. What is the version you installed?
  2. Have you ever installed Domain Locale in this Drupal instance before? - having previous settings saved in db may be the cause of the error.
  3. Are you adding the setting DL config using Drush or the UI?

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.

JeroenT’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)

I tried to reproduce this behaviour with a clean drupal installation, but it was not possible, so I guess it's already fixed then.

Mac_Weber’s picture

Thank you for the feedback Jeroen!

dgastudio’s picture

Priority: Normal » Major
Status: Closed (cannot reproduce) » Needs work

no, 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.

nonsie’s picture

Status: Needs work » Postponed (maintainer needs more info)

As always, which versions are you using?

dgastudio’s picture

the issue is about dev version, no?

nonsie’s picture

Which version of Domain Access?

dgastudio’s picture

version = "7.x-3.11"

roeldl’s picture

The problem occurs when you change your default language under admin/config/regional/language without assigning a default language under your domain languages settings.

Mac_Weber’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

@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.

a.milkovsky’s picture

Status: Closed (fixed) » Needs review
FileSize
530 bytes

Issue is not resolved. I still receive:

Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() (line 2171 of /srv/default/vcs/web/includes/database/database.inc).

Next patch fixes the issue

vasi1186’s picture

The 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.

Mac_Weber’s picture

Status: Needs review » Fixed

Comitted last patch.

Status: Fixed » Closed (fixed)

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