When locale is enabled I get the following SQL error.

Warning: Illegal offset type in isset or empty in locale() (line 669 of /home/lsolesen/workspace/vih_dk_build/modules/locale/locale.module).
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 'A more complete description calendar component than that provided by the summa' at line 1: SELECT s.lid, t.translation, s.version FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.source = :source_name, :source_description, :source_parser_ical_handler AND s.context = :context AND s.textgroup = 'default'; Array ( [:language] => da [:context] => [:source_name] => Description [:source_description] => A more complete description calendar component than that provided by the summary property. [:source_parser_ical_handler] => formatText ) i locale() (linje 676 af /home/vih/vih.dk/modules/locale/locale.module).

The undefined offset is $context in these lines from locale and the sql error refers to the following sql:

 if (!isset($locale_t[$langcode][$context][$string])) {

    // We do not have this translation cached, so get it from the DB.
    $translation = db_query("SELECT s.lid, t.translation, s.version FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.source = :source AND s.context = :context AND s.textgroup = 'default'", array(
      ':language' => $langcode,
      ':source' => $string,
      ':context' => (string) $context,
    ))->fetchObject();

// ... more code
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lsolesen’s picture

The debug_backtrace() called right befoer the code can be seen her: http://pastebin.ca/2105973

lsolesen’s picture

Attached patch which seems to fix the problem.

lsolesen’s picture

Status: Active » Needs review
straight-shoota’s picture

Seems to solve the error.

plonk’s picture

Status: Needs review » Reviewed & tested by the community

Can confirm this fix.

plonk’s picture

Issue summary: View changes

Added the undefined offset and code snippet from locale.