After updating to the 7.x-1.6 release I get the following error when trying to flush a style:

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=4385260&op=do StatusText: Service unavailable (with message) ResponseText: Recoverable fatal error: Argument 1 passed to imagecache_coloractions_create_htaccess_for_style() must be of the type array, boolean given, called in /opt/git/acquia/d7/docroot/sites/all/modules/contrib/imagecache_actions/coloractions/imagecache_coloractions.module on line 184 and defined in imagecache_coloractions_create_htaccess_for_style() (line 29 of /opt/git/acquia/d7/docroot/sites/all/modules/contrib/imagecache_actions/coloractions/imagecache_coloractions.htaccess_creator.inc).

In our case all of our image styles are defined in Features and not in the database. This is what causes the issue.

In coloractions/imagecache_coloractions.module the call to image_style_load assumes there is an image style ID available to load an image style. When image styles are in Features, they do not have an ID, so the image style machine name should be used (and seems like the better call anyway).

function imagecache_coloractions_image_style_flush(array $style) {
  // Error in core: the old style + set of effects is passed in. This means
  // that when a convert effect is added or deleted we won't notice. So we
  // "change" the order of execution by duplicating these lines from
  // image_style_flush():
  // Clear image style and effect caches.
  cache_clear_all('image_styles', 'cache');
  cache_clear_all('image_effects:', 'cache', TRUE);
  drupal_static_reset('image_styles');
  drupal_static_reset('image_effects');

  // Now load the current state of our style.
  $new_style = image_style_load(NULL, $style['isid']);

  // Now back to our actual work: determine if we have to crate an .htaccess
  // file.
  include_once dirname(__FILE__) . '/imagecache_coloractions.htaccess_creator.inc';
  imagecache_coloractions_create_htaccess_for_style($new_style);
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jaydub created an issue. See original summary.

  • fietserwin committed 9a1ad31 on 7.x-1.x
    [#2671526]: Fatal error on image style flush when image styles are...
fietserwin’s picture

Title: Fatal error on image style flush when image styles in Features » Fatal error on image style flush when image styles are defined in Features
Version: 7.x-1.x-dev » 7.x-1.6
Priority: Normal » Major
Status: Needs review » Fixed

Thanks for reporting. Added some extra checks, see e.g. #2190759: hook_image_style_flush(): Prefer silent failure over clear failure.

Fixed and committed. I think this deserves a new release.

  • fietserwin committed 9a1ad31 on 8.x-1.x
    [#2671526]: Fatal error on image style flush when image styles are...

Status: Fixed » Closed (fixed)

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