I'm getting:

# Notice: Undefined index: base theme in system_find_base_themes() (line 942 of [SITEURL]/modules/system/system.module).

which goes away when I disable skinr

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jacine’s picture

Thanks for the report Melissa :D

I'll check it out.

Jacine’s picture

Title: Undefined index: base theme in system_find_base_themes() (line 942 of ..modules/system/system.module » Fix notices

Ok, I can easily reproduce this with using any theme (whether it has a base theme or not). There are also a quite a 2 other issues I'm seeing:

notice: Undefined variable: skinr in /Users/jacine/Sites/drupal-6/sites/all/themes/skinr_one/page.tpl.php on line 94.

Yes, this is technically the theme, but we can prevent it, so we should.

notice: Undefined index: preprocess_hook in /Users/jacine/Sites/drupal-6/sites/skinr-1.x/modules/skinr/skinr.module on line 111.

Getting this when editing panels panes/regions.

Jacine’s picture

I've got fixes for the notices in #2, but I can't seem to figure out how to fix the base themes issue.

It's only happening when there is not a base theme, and this line is the problem:

$themes = array_keys(system_find_base_themes(_system_theme_data(), $current_theme));

I assume the issue is that since system_find_base_themes() is returning NULL, trying to do the array_keys() part is throwing a notice? Nothing I've tried so far as fixed it yet.

Jacine’s picture

Status: Active » Needs review
FileSize
1.37 KB

I've attached the fixes for the notices mentioned in #2, but I think the "base themes" issue is a core bug. We need that code, and there doesn't appear to be any way to prevent the notice. Luckily this is a very minor issue, as these should never display on any live site. Drupal core prevents them from displaying entirely, and you need to specifically hack core, from my experience to make them appear.

nomonstersinme’s picture

Status: Needs review » Reviewed & tested by the community

I can verify there are no more notices with the above patch in 6.x-1.x dev

Jacine’s picture

Title: Fix notices » base theme, skinr and preprocess hook notices.
Status: Reviewed & tested by the community » Fixed
Alexander Allen’s picture

Version: 6.x-1.x-dev » 6.x-1.5
Status: Fixed » Active

Reopened. I'm getting the same problem, but on version 1.5 Undefined index: base theme in system_find_base_themes() (line 942 of ..modules/system/system.module.

Trying to replace line 942 with the one found on the patch didn't work either.

Jacine’s picture

Status: Active » Closed (won't fix)

If you have a fix for this, feel free to post a patch. Otherwise, please see comment #2.

Marking "wont fix" but it really should be "can't fix."

EDIT: err, comment #4, not #2.

Alexander Allen’s picture

Status: Closed (won't fix) » Active

Jacine,

I would consider this is a core bug as well. I replicated the error while having Garland enabled.

See: http://skitch.com/richard-alexander-allen/d7gpt/943782-skinr

The only thing it occurs to me to prevent the error is to do our own implementation of function system_find_base_themes in skinr.

Alexander Allen’s picture

Assigned: Unassigned » Alexander Allen
Status: Active » Needs work

Will post patch.

Alexander Allen’s picture

Version: 6.x-1.5 » 6.x-1.x-dev
Status: Needs work » Patch (to be ported)
FileSize
2.36 KB

Substituted system_find_base_themes with skinr_find_base_themes on function skinr_preprocess. This eliminated the error found in the bug description and comment #9.

Jacine’s picture

Status: Patch (to be ported) » Needs review

As far as I know, skinr_find_base_themes() does not work properly (for what Skinr needs it to do), which is why it's not being used.

@moonray Can you please look into this?

Alexander Allen’s picture

Status: Needs review » Patch (to be ported)

Jacine,

skinr_find_base_themes is a copy I made of system_find_base_themes (and attached it in the patch). It did solve the error I screen-grabbed on comment #9. Patch in comment #4 didn't solve the issue on comment #9, since I am working off the dev version. If I revert my patch for example, the error on comment #9 comes back up. DM if you have any further questions.

Thank you.

Alexander Allen’s picture

Status: Patch (to be ported) » Needs review

Accidentally changed status, changed back to needs review. Sorry.

Alexander Allen’s picture

I just found out that my changes, for some reason I don't know, force Panels 3.7 into legacy mode (like described in issue http://drupal.org/node/866184).

Reverting the patch make the errors in #9 (and #2) return, but take Panels out of legacy mode (no warning message on the module status page).

I'll give another shot to trying fixing this.

moonray’s picture

Status: Needs review » Needs work
rfay’s picture

Status: Needs work » Needs review
FileSize
611 bytes

From #981210: Warning messages from skinr if a theme that does not have a base theme is in use...

Isn't this enough to fix this?

I'm not really following the issue, nor a skinr user, so just had to figure out why my sandbox was outputting warnings.

Jacine’s picture

Ok, well here's a couple of things about this:

1 - It happens when using Skinr on a regular theme. If you are using a subtheme, you get no notices.
2 - We were using system_theme_data() initially, but changed to _system_theme_data() in this commit in an attempt to try and fix this issue #581604: skinr disable the active theme.

@moonrays comment at the time was:

When calling system_theme_data() to grab all the theme info, there's a problem where all themes get disabled when running update.php. If we call _system_theme_data() instead, the problem is solved. It's also more efficient. The only annoyance is that it's a supposed to be a private function...

So, I don't know what's better: Notices or themes constantly being disabled on update, but apparently people are still running into the core bug. The nature of this problem is pretty serious, as Skinr NEEDS an active theme to function, which is why I would probably stick with the notices. But, apparently people are still running into that problem anyway.

Jacine’s picture

Title: base theme, skinr and preprocess hook notices. » _system_theme_data() causes PHP notices, but system_theme_data() causes themes to be disabled on update
Alexander Allen’s picture

What would prevent us from copying the contents of _system_theme_data() into a new function called skiner_system_theme_data() and using that instead? Would that disable the notices and the update problem?

WorldFallz’s picture

I tried the patch in 17, and it does indeed fix the problem. While the notice might seem like just an annoyance, they make it very painful when trying to troubleshoot anything else.

I also don't understand why the patch can't be used-- if there are no base themes you'll always get at least one theme (the $current_theme).

jpw1116’s picture

I just wanted to chime in that I've never used anything other than D7 and, with Skinr 7.x-2.x-dev enabled and Fusion core as my default theme, also get the notice "Undefined index: base theme in system_find_base_themes()."

Of course, setting the default theme to Fusion starter seems to remove the notice . . . but in the interest of any newbies setting Fusion core as the default, they will be seeing red.

esod’s picture

Thanks for addressing the issue. The patch in #17 made the notices go away on my site that uses skinr and Acquia Prosper.

ChrisBryant’s picture

Status: Needs review » Reviewed & tested by the community

It seems like rfay's patch in #17 can be set to RTBC based on comments #21 & 23 unless moonray or Jacine have any reasons not to (or if it's still won't/can't fix because of the core bug.)

sun’s picture

Status: Reviewed & tested by the community » Needs work

Thanks to Jacine's analysis in #18, the solution is simple:

  1. Revert to system_theme_data().
  2. Don't execute that function (or surrounding functions) on update.php; i.e.:
    if (defined('MAINTENANCE_MODE')) {
      return;
    }
    
Sivaji_Ganesh_Jojodae’s picture

Why don't we do a check before calling system_find_base_themes() ?

The following code change fixed the issue for me.

+  $themes = array();
   // Add any base themes.
-  $themes = array_keys(system_find_base_themes(_system_theme_data(), $current_theme));
+  $system_theme_data = _system_theme_data();
+  if (isset($system_theme_data[$current_theme]->info['base theme'])) {
+    $themes = array_keys(system_find_base_themes($system_theme_data, $current_theme));
+  }

verta’s picture

subscribing

tribe_of_dan’s picture

Sub

polishyourimage’s picture

Sub

Dane Powell’s picture

I got the same error when I migrated my site from stock Drupal to Pressflow, presumably because Skinr is using a private function (_system_theme_data()).

Applying the fix in #26 eliminated the error.

Dane Powell’s picture

FileSize
987 bytes

A patch with fix in 26, if it helps...

alberto56’s picture

Subscribing. The error I'm getting is "notice: Undefined index: base theme in [...]/modules/system/system.module on line 947"

mbannach’s picture

subscribing

Dane Powell’s picture

Status: Needs work » Needs review

I suppose #31 could use review

drupizzle’s picture

#26 worked for me as well. In case anybody has a similar issue I'm running Merucury Pantheon stack on Linode. Mercury, Varnish, Memcache, Pressflow 6

John Franklin’s picture

Status: Needs review » Reviewed & tested by the community

Patch file from #31 (a.k.a. the #26 fix) fixed a problem here, too. In particular, I was seeing it with Seven as the admin theme. Three "me, too" posts earns this the RTBC badge.

moonray’s picture

What about the suggestion in #25, though? We wouldn't need to use a private function, if that fixes the problems.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, skinr-943782-31.patch, failed testing.

moonray’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Assigned: Alexander Allen » Unassigned
Issue summary: View changes
Status: Needs work » Needs review
FileSize
5.02 KB

This patch uses the concept from #25. It reverts to using system_theme_data() instead of the private function _system_theme_data() and avoids callingthe function while running update.php.

We're applying to the 2.x branch first, then backporting.

  • Commit 7248638 on 6.x-2.x by moonray:
    Issue #943782 by moonray, Dane Powell, rfay, Alexander Allen, Jacine |...
moonray’s picture

Version: 6.x-2.x-dev » 6.x-1.x-dev
FileSize
4.02 KB

Now for the 1.x branch fix.

  • Commit 6b612ca on 6.x-1.x by moonray:
    Issue #943782 by moonray, Dane Powell, rfay, Alexander Allen, Jacine |...
moonray’s picture

Status: Needs review » Fixed

Done. Please reopen if still an issue.

Status: Fixed » Closed (fixed)

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

esclapes’s picture

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

I am afraid the reported notice: Notice: Undefined index: base theme in system_find_base_themes() was not fixed.

system_find_base_themes expects the second argument (in our case $data['current_theme']) to be a theme name with a base theme defined in its .info file.

The simplest fix is to check if this is set before calling system_find_base_themes Find a patch for 1.x attached.

esclapes’s picture

Found another php notice: Undefined variable: $current_theme that can be easily fixed so I just replaced the undefined variable with $data['current_path'] which is defined.

This patch includes the changes on #45

  • moonray committed 015f553 on 8.x-2.x
    Issue #943782 by moonray: Updated detection of maintenance mode in...
moonray’s picture

Status: Needs review » Fixed

I had to tweak the patch, but the parts that weren't already in are no committed.

  • moonray committed bc8c33f on 6.x-1.x
    Issue #943782 by moonray, esclapes: Fixed additional notices.
    

Status: Fixed » Closed (fixed)

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