1

I am running drupal 6 and I get this warning on every page.

warning: Illegal offset type in isset or empty in /var/www/my-website/includes/common.inc on line 915.

And this is what I have from lines 914 to 917 in common.inc file

// Custom strings work for English too, even if locale module is disabled.
if (isset($custom_strings[$langcode][$string])) {    /* Line: 915 */
  $string = $custom_strings[$langcode][$string];
}

What could be the possible reasons for the warning and how to get rid of it? Any help is appreciated. Thanks.

Edit: This warning appears only for anonymous users and it is not visible for authenticated users.

  • 1
    Did you recently install any modules? Try turning off the modules you have enabled one by one. Each time you turn off a module, clear the cache. Then check to see if the error still appears. Once you find which module is causing the problem, edit your question with the new information. – Patrick Kenny Apr 30 '12 at 7:51
  • @PatrickKenny: Thx for your comment. I will do that. – Vivek Apr 30 '12 at 7:55
  • @PatrickKenny: I disabled all the modules one by one and cleared all cache everytime but still no luck. The warning still appears on all the pages. – Vivek Apr 30 '12 at 8:05
  • 1
    Have you tried switching back to a default theme (if you are using a custom one). Does the error persist? Have you defined a new region in your theme .info file and not included it in your page.tpl.php? – md2 Apr 30 '12 at 10:01
  • 1
    Looks like a translation / Multilanguage issue perhaps translating an object or similar instead of string. – David Thomas Feb 1 '13 at 23:57
2

I have fixed the problem. I think this will help you. For me it works perfectly:

BEFORE:

// Custom strings work for English too, even if locale module is disabled.
if (isset($custom_strings[$langcode][$string])) {
  $string = $custom_strings[$langcode][$string];
}

AFTER:

// Custom strings work for English too, even if locale module is disabled.
if ($custom_strings[$langcode] && isset($custom_strings[$langcode][$string])) {
  $string = $custom_strings[$langcode][$string];
}
0

if you still need help solving the issue, you can try setting your own error handler to print a debug_backtrace to see exactly where the source of error is.

More details: http://blog.ryantan.net/2012/12/debugging-illegal-offset-type-in-isset-or-empty-in-for-drupal-7/

  • There is Devel module. – niksmac Dec 19 '12 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.