warning: Illegal offset type in isset or empty in insert.module on line 194
Getting the message in the title when editing, or saving any node using insert for cck image fields.

The line in question reads:

<?php
if (!isset($insert_styles[$default])) {
     
$insert_styles[$default] = $default;
    }
?>

I've dsm($default) - its the preset form imagecache, and it is an Array; I guess that's why it throws this warning, because its not a string.
The array looks like [0] => 'presetname'

As how to go about fixing this properly, I leave it up to you guys that know the inside out of this module better than me... willing to test patches, or if you have a pointer as to how to do it, I can work on it and provide one myself =)

Comments

It sounds like something went wrong when Insert tried to save the field settings. The default style is supposed to be configured via a select list on the field configuration page. If you're getting an array instead of a string, then somehow an array was returned by this select list instead of a string. This problem doesn't exist on a clean installation of Drupal/FileField/Insert.

Category:bug» support
Status:Needs review» Active

Thanks quicksketch for the quick reply, I will try debug it further on our install.

Status:Active» Fixed

OK, I think I've found what was causing this warning message, here is what the situation was for this imagefield configuration:

  1. Enable insert button was enabled.
  2. No Enabled insert styles were selected.
  3. A Default insert style was selected.

This was causing the warning apparently, for when I selected the Enabled insert styles that we needed, the warning stopped appearing.

Not sure wether the module should account for this situation or not, but in any case, I hope my comment here helps anyone that encounters this situation.

Thanks again for the quick reply!

This problem has already been fixed in CVS as part of #661426: What is you have a WYSIWYG field that isn't the body?. The default style is now acts as if it always enabled, even if it hasn't been explicitly checked. So when the next version comes out this won't be a problem again.

awesome qucksketch, thanks! -- glad this was a non-issue =)

Status:Fixed» Closed (fixed)

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

Status:Closed (fixed)» Active

I'm getting this same error, but only when the field is part of a flexifield:

1. Flexifield node has wysiwyg field, and insertable graphic field.
2. There are multiple Flexifield nodes in a parent node.
3. There is another wysiwyg field and insertable graphic field in the parent node.

The error comes up on ALL insertable graphic fields.

When I create a flexifield node by itself, the error does not come up.

For anyone else troubleshooting this issue: you will also receive this error if somehow all your Enabled Styles get unchecked and you are saving a document that already had styles applied. The fix, of course, is easy - re-enable the styles.

I don't really support Flexifield, but any patches I'd be happy to look at. I probably won't be installing the module to correct that problem.

Some similar problems when users update the module have also been encountered, a la #881964: Illegal offset type in isset or empty in...... (marked as duplicate).

This issue is still there in beta6, I was getting this warning until I reactivated the styles for the different content types.

Status:Active» Closed (fixed)

No updates in a while, as stated I don't support Flexifield. Please open a new issue if this problem is still occurring.

Version:6.x-1.0-beta4» 6.x-1.1
Priority:Normal» Minor
Status:Closed (fixed)» Active

I just bumped into this in 6.x-1.1.

Somehow, what I had set in the "ENABLED INSERT STYLES:" for my image field was erased. Not real sure how that happened, but it resulted in this exact same warning message.

Additionally, the Insert button itself stopped working. Clicking it just did nothing.

Following the steps above in comment #3 resolved the issue. I just had to resave the image field settings with something enabled.

Incidentally, I tried clearing out the enabled styles again and re-saving with nothing enabled, but I can't reproduce the issue. Even with nothing saved, it works fine. Mine must have been referencing options that no longer existed (deleted image cache setting maybe??).

I'm re-opening, but marking low priority since there is a resolution path above. I can't reproduce, so feel free to re-close if you want.

I ran into this error in 6.x-1.1. after exporting the Content type with CCK content copy. During this export, my field settings where deleted.

Just to be clear, I've never used Flexifield, so this must happen in other situations too. My situation was similar to that in #13 — something disabled all the enabled styles. Unfortunately I don't know what I had done prior to getting the error that might have been responsible for everything getting disabled. Maybe it was an export as in #14? I just know it wasn't related (in my case) to Flexifield.

Just happened out of the blue for me. No flexfield.

Same situation here.
If I check an Enabled insert style the same as the default style the error goes away.

This probably happens when a field is configured to insert a specific ImageCache preset, but then that preset is deleted. Now there aren't any presets defined that are valid, so the error is thrown(?) Just guessing here. I thought we already were accommodating for this situation. Doesn't seem like it's happening regularly for people.

@quicksketch, good detective work. As it turned out in my case, the Enable insert button was checked while no Enabled insert styles were selected. The errors I was getting appear below. Thanks!

- warning: Illegal offset type in isset or empty in /.../sites/all/modules/insert/insert.module on line 210.
- warning: Illegal offset type in /.../sites/all/modules/insert/insert.module on line 211.