Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?
Comment | File | Size | Author |
---|---|---|---|
#4 | switchtheme-DRUPAL-6--1.warning.patch | 6.87 KB | sun |
Comments
Comment #1
klonosAlso 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! (?)
Comment #2
klonosI 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.
Comment #3
klonosActually, 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.
Comment #4
sunThanks 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.