Disabling the module and then uninstalling produces the following error in watchdog log three (3) times.

Location http://domain.com/admin/build/modules/uninstall/confirm
Referrer http://domain.com/admin/build/modules/uninstall/confirm
Message uasort() [function.uasort]: The argument should be an array in /var/www/domain.com/beta/sites/all/modules/imagecache/imagecache.module on line 259.

CommentFileSizeAuthor
#9 imagecache-536608-9.patch487 bytesc4rl
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fizk’s picture

Status: Active » Closed (fixed)

Please reopen if this is still an issue with ImageCache 6.x-2.0-rc1.

Jorrit’s picture

Status: Closed (fixed) » Needs review

With ImageCache 6.x-2.0-rc1 I get an error upon installation that looks like the error from this issue:

warning: uasort() expects parameter 1 to be array, null given in /var/www/drupal6/sites/all/modules/imagecache/imagecache.module on line 287.

It looks like imagecache_action_definitions() needs something like $actions = array(); around line 278.

fizk’s picture

Status: Needs review » Closed (fixed)

Fixed in dev. Thanks!

Jorrit’s picture

Thanks for the quick fix!

yaslama’s picture

Version: 6.x-2.0-beta9 » 6.x-2.x-dev
Status: Closed (fixed) » Patch (to be ported)

With the last change, the action list is always empty, because isset($actions) is true after the initialisation.
I propose the following patch (tested in at least one site).

Thanks

--- a/imagecache/imagecache.module	2012-06-21 14:53:35.000000000 +0000
+++ b/imagecache/imagecache.module	2012-11-08 16:52:15.872033057 +0000
@@ -269,12 +269,13 @@
  *   An array of actions to be used when transforming images.
  */
 function imagecache_action_definitions($reset = FALSE) {
-  static $actions = array();
+  static $actions;
   if (!isset($actions) || $reset) {
     if (!$reset && ($cache = cache_get('imagecache_actions')) && !empty($cache->data)) {
       $actions = $cache->data;
     }
     else {
+      $actions = array();
       foreach (module_implements('imagecache_actions') as $module) {
         foreach (module_invoke($module, 'imagecache_actions') as $key => $action) {
           $action['module'] = $module;
fizk’s picture

How about changing the isset() to isempty()?

aturetta’s picture

Priority: Normal » Critical
Status: Patch (to be ported) » Needs review

#5 is confirmed, the latest dev breaks badly.
Either the diff #5 or the change suggested in #6 will do.

Edit: the change suggested in #6 is not 100% correct. The comparison should change from !isset($actions) to empty($actions)

c4rl’s picture

Title: Disabling the module and then uninstalling produces the following error » Missing imagecache actions when editing a preset
Status: Needs review » Needs work

Retitling to be more descriptive

c4rl’s picture

Status: Needs work » Needs review
FileSize
487 bytes

Gotta love 1-liners.

fizk’s picture

Status: Needs review » Fixed

Hopefully we got it this time :)

apotek’s picture

Status: Fixed » Reviewed & tested by the community

+1

Bitten by this bug.

Patch in #9 works for me.

Anyone else want to suggest this is RTBC? No one? Ok. Doing it myself. This issue shouldn't be marked fixed until the patch is committed, which is probably why the patch has been gathering dust since January.

fizk’s picture

Status: Reviewed & tested by the community » Fixed
apotek’s picture

Ah! And so it was. But it's just not present in the latest release. Should I switch over to the dev branch for my production line or should I just patch my RC1+4 version?

fizk’s picture

I recommend just patch production, unless you're comfortable going through all the commits in dev that your codebase doesn't have yet.

Status: Fixed » Closed (fixed)

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