When upgrading core from D5 to D6 the process works great in 6.22 and 6.23, but when using 6.24 the site is riddled with errors after the upgrade. The only theme I have enabled is garland, and it's using the default settings. (I've tested it multiple times.)

warning: Invalid argument supplied for foreach() in drupal-6.24/includes/theme.inc on line 497.
warning: Invalid argument supplied for foreach() in drupal-6.24/includes/theme.inc on line 502.
warning: Invalid argument supplied for foreach() in drupal-6.24/includes/theme.inc on line 497.
warning: Invalid argument supplied for foreach() in drupal-6.24/includes/theme.inc on line 502.
warning: Invalid argument supplied for foreach() in drupal-6.24/includes/theme.inc on line 497.
warning: Invalid argument supplied for foreach() in drupal-6.24/includes/theme.inc on line 502.
warning: Invalid argument supplied for foreach() in drupal-6.24/includes/theme.inc on line 497.
warning: Invalid argument supplied for foreach() in drupal-6.24/includes/theme.inc on line 502.
warning: Invalid argument supplied for foreach() in drupal-6.24/includes/theme.inc on line 497.
warning: Invalid argument supplied for foreach() in drupal-6.24/includes/theme.inc on line 502.
warning: array_map() [function.array-map]: Argument #2 should be an array in drupal-6.24/modules/system/system.module on line 1046.
warning: array_keys() expects parameter 1 to be array, null given in drupal-6.24/includes/theme.inc on line 1833.
warning: Invalid argument supplied for foreach() in drupal-6.24/includes/theme.inc on line 1833.

in D5 there was one entry in the system table for each theme, as follows:

+-------+------------+-----------------------------------+
| type  | name       | filename                          |
+-------+------------+-----------------------------------+
| theme | bluemarine | themes/bluemarine/page.tpl.php    |
| theme | chameleon  | themes/chameleon/chameleon.theme  |
| theme | marvin     | themes/chameleon/marvin/style.css |
| theme | minnelli   | themes/garland/minnelli/style.css |
| theme | garland    | themes/garland/page.tpl.php       |
| theme | pushbutton | themes/pushbutton/page.tpl.php    |
+-------+------------+-----------------------------------+

After an upgrade from D5 to D6 there are additional entries in the system table, an .info file has been added for each theme.

+-------+------------+---------------------------------------+
| type  | name       | filename                              |
+-------+------------+---------------------------------------+
| theme | bluemarine | themes/bluemarine/page.tpl.php        |
| theme | bluemarine | themes/bluemarine/bluemarine.info     |
| theme | chameleon  | themes/chameleon/chameleon.theme      |
| theme | chameleon  | themes/chameleon/chameleon.info       |
| theme | garland    | themes/garland/page.tpl.php           |
| theme | garland    | themes/garland/garland.info           |
| theme | marvin     | themes/chameleon/marvin/style.css     |
| theme | marvin     | themes/chameleon/marvin/marvin.info   |
| theme | minnelli   | themes/garland/minnelli/style.css     |
| theme | minnelli   | themes/garland/minnelli/minnelli.info |
| theme | pushbutton | themes/pushbutton/page.tpl.php        |
| theme | pushbutton | themes/pushbutton/pushbutton.info     |
+-------+------------+---------------------------------------+

in 6.24 when the list_themes function is called, it retrieves a "theme" for every theme entry in the system table, meaning half the time it's got a style sheet or a page.tpl.php file instead of an .info file, and throws these errors.

Comments

jenlampton’s picture

Issue summary: View changes

more information

jenlampton’s picture

Issue summary: View changes

clarify now

jenlampton’s picture

Issue summary: View changes

better sql

jenlampton’s picture

The following cleanup on the system table prevented the errors:

DELETE WHERE system WHERE type = "theme" AND filename LIKE "%.tpl.php";
DELETE FROM system WHERE type = "theme" AND filename LIKE "%.css";
DELETE FROM system WHERE type = "theme" AND filename LIKE "%.theme";

We should probably add this as an update hook.

webchick’s picture

Status: Active » Closed (duplicate)

I think this is a duplicate of #1425868: Duplicate entry of themes primary key in systems table of Drupal 6.24 (using Drush or Ægir), which means it should be fixed in 6.25 (Wednesday).

jenlampton’s picture

Yeah, the patch from #1425868: Duplicate entry of themes primary key in systems table of Drupal 6.24 (using Drush or Ægir) solved the D5 upgrade issues too, thanks for pointing me at that :)

jenlampton’s picture

Issue summary: View changes

ad D6 database table