I got this error this morning:

warning: Invalid argument supplied for foreach() in /var/www/larisa247/sites/all/modules/switchtheme/switchtheme.module on line 214.

Could be one of the last night's module updates. Anyone else getting this?

CommentFileSizeAuthor
#4 switchtheme-DRUPAL-6--1.warning.patch6.87 KBsun
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

klonos’s picture

Also this one:

warning: Invalid argument supplied for foreach() in /var/www/larisa247/sites/all/modules/switchtheme/switchtheme.admin.inc on line 14.

in the module's admin page (../admin/settings/switchtheme).

Beats me! (?)

klonos’s picture

I noticed that the switchtheme block's drop down selection menu was empty (!?), so I checked my themes page. I saw that all themes where disabled! Even the default one that was actively loaded and being used(?)

Enabling at least one theme made the issue go away. Was that weird behavior or what?

I bet that all themes getting disabled is not related to this module neither caused by it (core perhaps?). I will leave this issue open for a while (if no one minds), just to see if anyone else faced same or similar behavior recently.

klonos’s picture

Actually, this seems to be #305653: Themes disabled during update and perhaps its related #632080: _system_theme_data() should clone the returned objects.. So, I know this is drupal core issue now, but I believe it would be a good thing if there was a check to see if all themes are disabled. If so, warn the user to enable at least one theme or their default theme. The check should be before the foreach ($options as $option) in both the switchtheme.admin.inc, line 14 and switchtheme.module, line 214 or wherever else required.

That because despite the fact that this needs to be fixed in core, it still throws an error that points to switchtheme module files. So, it is more likely that users will end up looking for a solution here first.

Thanks for considering this.

sun’s picture

Status: Active » Fixed
FileSize
6.87 KB

Thanks for reporting, reviewing, and testing! Committed attached patch.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

Status: Fixed » Closed (fixed)

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