There is an infinite recursion inside function wysiwyg_imageupload_imagecache_default_presets(). Function imagecache_presets() calls hook_imagecache_default_presets() inside its body. This is the source of problem. I suggest to set static varaible.

CommentFileSizeAuthor
#5 bsod2.patch1.78 KBkndr
#1 bsod.patch1.78 KBkndr

Comments

kndr’s picture

StatusFileSize
new1.78 KB

This is my patch

eugenmayer’s picture

Version: 6.x-1.0-beta5 » 6.x-1.0-beta6
Status: Needs review » Fixed

You are ofc right, i did not thought to well about that one. Thanks of the patch!

Fixed in BETA7

eugenmayer’s picture

Status: Fixed » Closed (fixed)
kndr’s picture

Version: 6.x-1.0-beta6 » 6.x-1.0-beta7
Status: Closed (fixed) » Active

Patch hasn't been properly applied in beta7

kndr’s picture

Status: Active » Needs review
StatusFileSize
new1.78 KB

The same patch but for beta7

eugenmayer’s picture

The patch has been applied, but the preset "Big" has been removed (before in BETA5). The current patch just adds it again, i cant see it changing an logics?

kndr’s picture

Hm. For me, logic is differnet. Look at if statement and its brackets. Function imagecache_presets should be called only once.

Before patch:

  static $presets;
  if (!isset($presets)) {
    $presets = array();

      // Only expose those presets if no presets in the system right now
    $presets = imagecache_presets();
    if(count($presets) > 0) {
        return array();
    }
  }

  // Only expose those presets if no presets in the system right now
  $presets = imagecache_presets();
  if(count($presets) > 0) {
    return array();
  }

  $presets = array();
  $presets['original'] = array (
    'presetname' => t('Original'),
    'actions' => array (),
  );
  $presets['big'] = array (
    'presetname' => t('Big'),
    'actions' =>
    array (
      0 =>
      array (
        'weight' => '0',
        'module' => 'imagecache',
        'action' => 'imagecache_scale',
        'data' =>
        array (
          'width' => '640',
          'height' => '',
          'upscale' => 0,
        ),
      ),
    ),
  );

  return $presets;

After patch:

  static $presets;
  if (!isset($presets)) {
    $presets = array();
    // Only expose those presets if no presets in the system right now
    $presets = imagecache_presets();
    if(count($presets) > 0) {
      return array();
    }
    $presets['original'] = array (
      'presetname' => t('Original'),
      'actions' => array (),
    );
    $presets['big'] = array (
      'presetname' => t('Big'),
      'actions' =>
      array (
        0 =>
        array (
          'weight' => '0',
          'module' => 'imagecache',
          'action' => 'imagecache_scale',
          'data' =>
          array (
            'width' => '640',
            'height' => '',
            'upscale' => 0,
          ),
        ),
      ),
    );
  }
  return $presets;
eugenmayer’s picture

Thats not needed, as its already cached and not called on every request.

The only thing was the raise condition to be cared of, so if cache is clean, we dont get locked.

Convinced, or did i still miss something?

kndr’s picture

I was trying to reproduce the error WSOD after intstallation WYSIWYG Imageupload (my mistake - white screen of death, not blue :) )

Try reproduce this error in 4 steps:

1) Install fresh copy Drupal 6.15.

2) Enable:
Color
Comment
Database Logging
Help
Menu
Taxonomy
Update Status

3) Install
Image API 6.x-1.x-dev
Image API GD2 6.x-1.x-dev
Image Cache 6.x-2.x-dev
Image Cache UI 6.x-2.x-dev
CVS Deploy 6.x-1.x-dev
Transliteration 6.x-2.x-dev
jQuery UI 6.x-1.x-dev
jQuery Update 6.x-2.x-dev
Wysiwyg 6.x-2.x-dev
JQueryUpdate 6.x-1.0

Drupal works well.

4) Now, install WYSIWYG ImageUpload and you will see WSOD.

eugenmayer’s picture

kndr thank you a lot for your time!

And you actually think, this is because of this piece of unpatched code? Is it a single case, does it work after it?

kndr’s picture

Problem has gone when I patch the beta7 with #5 but first try to reproduce this error before you make any decision and commit changes to your code.

EgonO’s picture

same problem here - patch from #5 fixed the error.

eugenmayer’s picture

Status: Needs review » Fixed

Ok fine, convinced. Will apply the patch to BETA8. Thanks!

eugenmayer’s picture

Status: Fixed » Closed (fixed)