When trying to install this module via an install profile I receive the following error:

Notice: Undefined index: field in _fences_theme() (line 30 of
\modules\contrib\fences\fences.admin.inc)

The error shows up after the installation screen on the Configure Site form.

CommentFileSizeAuthor
#7 undefined-index-1561244-7.patch609 bytesroysegall

Comments

sylus’s picture

Issue summary: View changes

Mod

Sborsody’s picture

Hah, I was *just* doing the same thing! I get undefined index errors on lines 30 and 32. I added fences to the info file and was testing installation. There are some features with content types and fields installed too. I think it has something to do with the features being defined before fences was installed.

sylus’s picture

I am using features as well so could very well be the problem.

johnalbin’s picture

Title: Undefined Index » Undefined Index (with installation profiles and features?)

Updating title

sylus’s picture

I should mention I did manage to load fences during the installation but only when enabling it manually in the final install task. Obviously not a perfect solution but a temporary workaround.

johnalbin’s picture

Status: Active » Postponed (maintainer needs more info)

So, fences implements hook_module_implements_alter so that it's fences_theme() runs after field_theme() because it needs to copy some data from the theme registry details specified in the "field" hook which gets added by field_theme().

The "undefined index" means that the theme registry is empty for the "field" hook when fences_theme() is run. Can you add some debugging code to see if field_theme() is run before fences_theme()?

adamdicarlo’s picture

@JohnAlbin,

Have you seen Jose Reyero's comment on the doc page for hook_module_implements_alter()?

Issues he linked: #496170: module_implements() cache can be polluted by module_invoke_all() being called (in)directly prior to full bootstrap completion, #1267966: Pathauto patterns are not showing up (see comment #87).

Like the OP, I'm getting this Fences PHP notice a bajillion times when enabling the module in an install profile via the .info file.

roysegall’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new609 bytes

Guys, i ran in to this problem as well. In one of the instllation profile i'm activating the module. The problem is that there is no implementation by any hook and we get this error.

I attached the patch i did and i didn't get any notices during the installation and the module work as it should be(the field get the right fence).

Enjoy ;

sylus’s picture

Works for me thanks @RoySegall for the fix!

roysegall’s picture

Status: Needs review » Reviewed & tested by the community

i dont have a rtbc but i think it should be fine for that.

johnalbin’s picture

Status: Reviewed & tested by the community » Fixed

Ok. Since the fix for this is easy and only affects the not-often-called theme registry build, I'm fine with adding this patch.

HOWEVER, NOTE THESE 2 THINGS:

  1. This "work-around" is just masking a deeper problem with your site. Some module (Features?) is causing an incorrect cache of "module_implements" which, in turn, causes the theme registry to be built wrong because Fences requires hook_module_implements_alter() and the system is skipping Fences' implementation of that hook. You really need to flush all caches and rebuild the theme registry.
  2. Under the broken conditions described in #1 above, fences has effectively disabled itself. All its magic depends on a correctly-built theme registry.

Fixed! http://drupalcode.org/project/fences.git/commitdiff/9c6d7d6

Thanks, Roy! http://drupal.org/node/1284600/committers

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

Mod

minoroffense’s picture

Issue summary: View changes

I'm currently working on an install profile as this issue is still present in the latest stable version of Fences. Any chance of a 1.1 to fix the bug? It's been a while since a release was made regardless.