Give the gift of Drupal. All merchandise is 50% off through 2016.
Tried upgrading from Drupal 5 with this module turned on. On every possible screen of my update.php run, there is this error message which distracts from the real errors, and will eventually cause misunderstandings to users coloring imagecache as a bad-bad module.
warning: Invalid argument supplied for foreach() in /....../imagecache/imagecache.module on line 125.
If you look at this line, this is inside a hook_theme() implementation of the module which calls out to
imagecache_presets() does not look like a broken monster but it does surface one problem with the Drupal 5 and Drupal 6 API differences. It does not clear the cache, because $reset is FALSE, then it does not return because the static $presets is empty. So it gets to getting the data from cache, caching it in static cache and eventually returning it.
And there comes our problem. In Drupal 5, you serialize() a structure and put it into the cache, and when you get it from cache, you unserialize it. In Drupal 6 there is a "serialized" column, which is 1 if the data is serialized and should be deserialized when used. Since that column is not prefilled for existing data with 1, the existing data is just returned as is and will not work with the foreach() in the above mentioned hook_theme() implementation.
I think there are basically two ways out:
1. Fix imagecache_theme() so if imagecache_presets() does not return an array, it does not do a foreach. This might corrupt the initial theme cache, but that will AFAIR be regenerated after update.php is completed.
2. Fix imagecache_presets(), so that it does not think the data is right if it is not an array, and does go on to regenerate the data. Then if imagecache_preset_actions() also runs fine, it should regenerate the data well. I think this way others using imagecache_presets() should also get the right data in the update.
Attached simple patch is for (2). With added comments.