i18strings_cache will return an array part of the strings array if objectid is 0 once it has been cached. In i18nstrings_cache the while loop will bail out on !empty($context->objectid) since '0' is considered empty in PHP. I worked around the issue by replacing !empty with isset, but perhaps this has other side effects. Anyhow, I got this bug by using context, the admin module with context inspector and an untranslated title for the locale language switcher block (with block delta 0), so that setup could probably be used to reproduce the bug.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

noomz’s picture

Version: 6.x-1.x-dev » 6.x-1.10
Component: Code » Blocks
Priority: Normal » Major
FileSize
858 bytes

I second @gnucifer, should change to "isset" because objectid can be 0(zero) in any custom module user created. If the purpose is not allow the empty string, I think using "trim" along with "isset" should be better. See in patch.

K15.Multik’s picture

In my opinion, it is additionally necessary to check whether the value is a number.
Replace !empty($context->$field) with (!empty($context->$field) || is_numeric($context->$field)).

K15.Multik’s picture

Needs review ))

Status: Needs review » Needs work
Anonymous’s picture

Issue summary: View changes

clarification

oliverpolden’s picture

I can confirm I've seen this issue. The patch in #3 works for me.

I've also had a look at the reasons the tests have failed for the patch. I'm not sure exactly how to interpret it but it looks like the test is failing to log in however I've locally tested logging in with a translated block and it works fine.

joseph.olstad’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)