Either the error was coming with upgrade to 7.10 or it was there before w/o me recognising it.
When the WYSIWYG Filter module is activated and I go to admin/structure/block/add I'll get the following error:

Fatal error: Unsupported operand types in /var/www/vhosts/lokarabia-stage.de/httpdocs/modules/filter/filter.module on line 683

which code is

$filter->settings += $filter_info[$name]['default settings'];

It seems some settings probably have a wrong format, but I'm quite new to Drupal and therefore cannot easily locate the error or wrong setting format.

Tell me if and how I can be of further help to debug it.

Comments

mariomaric’s picture

Priority: Major » Normal

Hi.

I have fresh D7.10 and WYSIWYG Filter 7.x-1.6-rc2 enabled and activated in one text format and I cannot reproduce your error..

jazzitup’s picture

Issue summary: View changes

I could reproduce the issue. I tried it with PHP 5.3 and PHP 5.5:

PHP Fatal error:  Unsupported operand types in /var/www/drupal/dev/modules/filter/filter.module on line 718
PHP Stack trace:
PHP   1. {main}() /var/www/drupal/dev/index.php:0
PHP   2. menu_execute_active_handler() /var/www/drupal/dev/index.php:21
PHP   3. drupal_deliver_page() /var/www/drupal/dev/includes/menu.inc:532
PHP   4. drupal_deliver_html_page() /var/www/drupal/dev/includes/common.inc:2563
PHP   5. menu_execute_active_handler() /var/www/drupal/dev/includes/common.inc:2621
PHP   6. call_user_func_array() /var/www/drupal/dev/includes/menu.inc:517
PHP   7. node_page_view() /var/www/drupal/dev/includes/menu.inc:0
PHP   8. node_show() /var/www/drupal/dev/modules/node/node.module:2757
PHP   9. node_view_multiple() /var/www/drupal/dev/modules/node/node.module:1472

Disabling the module helps as a workaround to bring back the site.
drush dis wysiwyg_filter && drush cc all && drush cron

jazzitup’s picture

This is definitely a wysiwyg_filter's issue:

I replaced the following line 718 inside of the filter.module:

          $filter->settings += $filter_info[$name]['default settings'];

... with this:

          if (!is_array($filter->settings)) var_dump($filter);
          $filter->settings += $filter_info[$name]['default settings'];

The output:

object(stdClass)[404]
  public 'format' => string 'full_html' (length=9)
  public 'module' => string 'wysiwyg_filter' (length=14)
  public 'name' => string 'wysiwyg' (length=7)
  public 'weight' => string '0' (length=1)
  public 'status' => string '0' (length=1)
  public 'settings' => boolean false
  public 'title' => string 'WYSIWYG Filter' (length=14)
object(stdClass)[419]
  public 'format' => string 'filtered_html' (length=13)
  public 'module' => string 'wysiwyg_filter' (length=14)
  public 'name' => string 'wysiwyg' (length=7)
  public 'weight' => string '0' (length=1)
  public 'status' => string '0' (length=1)
  public 'settings' => boolean false
  public 'title' => string 'WYSIWYG Filter' (length=14)

If I replace again the aforementioned line 718, but this time with:

          if (!is_array($filter->settings)) $filter->settings = array();
          $filter->settings += $filter_info[$name]['default settings'];

I temporarily fixed the issue and see no PHP errors.
Wysiwyg should fix the $filter->settings before passing it to filter_list_format().

jazzitup’s picture

Priority: Normal » Critical

Marking this bug as critical, since it breaks the site.

Jorge Navarro’s picture

The problem also comes by using HTML Purifier. #3 Fixes the issue... there should be some text format settings causing this problem, patching core is always a problem.

drupalnewie @berfi’s picture

After moving site from folder to another folder, i face this similar issue. The numbers in here didn't solve my problem.

xtfer’s picture

I don't think this is a an issue with this module. The filter settings are saved and retrieved by Drupal core. If the unserialise operation fails its probably because the encoding has changed. This may happen because one server is running mbstring set differently to another.

stefan.r’s picture

Status: Active » Needs work

Setting to NW given #6 and #7.

geek-merlin’s picture

Status: Needs work » Postponed (maintainer needs more info)

Is this still an issue for someone?

geek-merlin’s picture

If yes, please post how to reproduce this on a clean install.

jazzitup’s picture

I ran into this issue again, but under different setup: currently I don't use WYSIWYG Filter, but still can reproduce this bug.

@xtfer: You were right. The issue is related to serialize/unserialize. My unserialize function fails to process the longest serialized string:

string(5017)

a:2:{s:17:"htmlpurifier_help";i:1;s:28:"htmlpurifier_advanced_config";a:120:{s:24:"Null_Attr.AllowedClasses";s:1:"1";s:24:"Attr.AllowedFrameTargets";s:0:"";s:15:"Attr.AllowedRel";s:0:"";s:15:"Attr.AllowedRev";s:0:"";s:23:"Null_Attr.ClassUseCDATA";s:1:"1";s:25:"Null_Attr.DefaultImageAlt";s:1:"1";s:24:"Attr.DefaultInvalidImage";s:0:"";s:27:"Attr.DefaultInvalidImageAlt";s:13:"Invalid image";s:19:"Attr.DefaultTextDir";s:3:"ltr";s:13:"Attr.EnableID";s:1:"0";s:21:"Attr.ForbiddenClasses";s:0:"";s:18:"Null_Attr.ID.HTML5";s:1:"1";s:16:"Attr.IDBlacklist";s:0:"";s:27:"Null_Attr.IDBlacklistRegexp";s:1:"1";s:13:"Attr.IDPrefix";s:0:"";s:18:"Attr.IDPrefixLocal";s:0:"";s:24:"AutoFormat.AutoParagraph";s:1:"1";s:17:"AutoFormat.Custom";s:0:"";s:25:"AutoFormat.DisplayLinkURI";s:1:"0";s:18:"AutoFormat.Linkify";s:1:"1";s:33:"AutoFormat.PurifierLinkify.DocURL";s:3:"#%s";s:26:"AutoFormat.PurifierLinkify";s:1:"0";s:32:"AutoFormat.RemoveEmpty.Predicate";s:33:"colgroup:
th:
td:
iframe:src
";s:44:"AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions";s:6:"td
th";s:33:"AutoFormat.RemoveEmpty.RemoveNbsp";s:1:"0";s:22:"AutoFormat.RemoveEmpty";s:1:"0";s:39:"AutoFormat.RemoveSpansWithoutAttributes";s:1:"0";s:19:"CSS.AllowDuplicates";s:1:"0";s:18:"CSS.AllowImportant";s:1:"0";s:15:"CSS.AllowTricky";s:1:"0";s:21:"Null_CSS.AllowedFonts";s:1:"1";s:26:"Null_CSS.AllowedProperties";s:1:"1";s:23:"CSS.ForbiddenProperties";s:0:"";s:16:"CSS.MaxImgLength";s:6:"1200px";s:15:"CSS.Proprietary";s:1:"0";s:11:"CSS.Trusted";s:1:"0";s:20:"Cache.DefinitionImpl";s:6:"Drupal";s:25:"Null_Cache.SerializerPath";s:1:"1";s:27:"Cache.SerializerPermissions";s:3:"493";s:22:"Core.AggressivelyFixLt";s:1:"1";s:29:"Core.AggressivelyRemoveScript";s:1:"1";s:28:"Core.AllowHostnameUnderscore";s:1:"0";s:18:"Core.CollectErrors";s:1:"0";s:18:"Core.ColorKeywords";s:254:"maroon:#800000
red:#FF0000
orange:#FFA500
yellow:#FFFF00
olive:#808000
purple:#800080
fuchsia:#FF00FF
white:#FFFFFF
lime:#00FF00
green:#008000
navy:#000080
blue:#0000FF
aqua:#00FFFF
teal:#008080
black:#000000
silver:#C0C0C0
gray:#808080
";s:30:"Core.ConvertDocumentToFragment";s:1:"1";s:36:"Core.DirectLexLineNumberSyncInterval";s:1:"0";s:20:"Core.DisableExcludes";s:1:"0";s:15:"Core.EnableIDNA";s:1:"0";s:13:"Core.Encoding";s:5:"utf-8";s:26:"Core.EscapeInvalidChildren";s:1:"0";s:22:"Core.EscapeInvalidTags";s:1:"0";s:29:"Core.EscapeNonASCIICharacters";s:1:"0";s:19:"Core.HiddenElements";s:13:"script
style";s:13:"Core.Language";s:2:"en";s:24:"Core.LegacyEntityDecoder";s:1:"0";s:19:"Null_Core.LexerImpl";s:1:"1";s:29:"Null_Core.MaintainLineNumbers";s:1:"1";s:22:"Core.NormalizeNewlines";s:1:"1";s:21:"Core.RemoveInvalidImg";s:1:"1";s:33:"Core.RemoveProcessingInstructions";s:1:"0";s:30:"Null_Core.RemoveScriptContents";s:1:"1";s:13:"Filter.Custom";s:0:"";s:34:"Filter.ExtractStyleBlocks.Escaping";s:1:"1";s:36:"Null_Filter.ExtractStyleBlocks.Scope";s:1:"1";s:39:"Null_Filter.ExtractStyleBlocks.TidyImpl";s:1:"1";s:25:"Filter.ExtractStyleBlocks";s:1:"0";s:14:"Filter.YouTube";s:1:"0";s:17:"Null_HTML.Allowed";s:1:"1";s:27:"Null_HTML.AllowedAttributes";s:1:"1";s:20:"HTML.AllowedComments";s:0:"";s:31:"Null_HTML.AllowedCommentsRegexp";s:1:"1";s:25:"Null_HTML.AllowedElements";s:1:"1";s:24:"Null_HTML.AllowedModules";s:1:"1";s:23:"HTML.Attr.Name.UseCDATA";s:1:"0";s:17:"HTML.BlockWrapper";s:1:"p";s:16:"HTML.CoreModules";s:95:"Structure
Text
Hypertext
List
NonXMLCommonAttributes
XMLCommonAttributes
CommonAttributes";s:23:"Null_HTML.CustomDoctype";s:1:"1";s:12:"HTML.Doctype";s:22:"XHTML 1.0 Transitional";s:25:"HTML.FlashAllowFullScreen";s:1:"0";s:24:"HTML.ForbiddenAttributes";s:0:"";s:22:"HTML.ForbiddenElements";s:0:"";s:17:"HTML.MaxImgLength";s:4:"1200";s:13:"HTML.Nofollow";s:1:"0";s:11:"HTML.Parent";s:3:"div";s:16:"HTML.Proprietary";s:1:"0";s:14:"HTML.SafeEmbed";s:1:"0";s:15:"HTML.SafeIframe";s:1:"0";s:15:"HTML.SafeObject";s:1:"0";s:18:"HTML.SafeScripting";s:0:"";s:11:"HTML.Strict";s:1:"0";s:16:"HTML.TargetBlank";s:1:"0";s:19:"HTML.TargetNoopener";s:1:"1";s:21:"HTML.TargetNoreferrer";s:1:"1";s:12:"HTML.TidyAdd";s:0:"";s:14:"HTML.TidyLevel";s:6:"medium";s:15:"HTML.TidyRemove";s:0:"";s:12:"HTML.Trusted";s:1:"0";s:10:"HTML.XHTML";s:1:"1";s:28:"Output.CommentScriptContents";s:1:"1";s:19:"Output.FixInnerHTML";s:1:"1";s:18:"Output.FlashCompat";s:1:"0";s:19:"Null_Output.Newline";s:1:"1";s:15:"Output.SortAttr";s:1:"0";s:17:"Output.TidyFormat";s:1:"0";s:17:"Test.ForceNoIconv";s:1:"0";s:18:"URI.AllowedSchemes";s:41:"http
https
mailto
ftp
nntp
news
tel";s:13:"Null_URI.Base";s:1:"1";s:17:"URI.DefaultScheme";s:4:"http";s:11:"URI.Disable";s:1:"0";s:19:"URI.DisableExternal";s:1:"0";s:28:"URI.DisableExternalResources";s:1:"0";s:20:"URI.DisableResources";s:1:"0";s:8:"URI.Host";s:31:"www.my.local";s:17:"URI.HostBlacklist";s:0:"";s:16:"URI.MakeAbsolute";s:1:"0";s:14:"Null_URI.Munge";s:1:"1";s:18:"URI.MungeResources";s:1:"0";s:23:"Null_URI.MungeSecretKey";s:1:"1";s:26:"URI.OverrideAllowedSchemes";s:1:"1";s:25:"Null_URI.SafeIframeRegexp";s:1:"1";}}

Localhost watchdog throws the following notice:

Notice: unserialize(): Error at offset 4777 of 5017 bytes in filter_list_format() (line 723 of /srv/http/my/modules/filter/filter.module).

Setup from above works well on my production server, but as soon as I migrated the site to my localhost, I faced this issue again. Both versions of PHP are the same: v7.3.7. Mbstring configuration on both sites displays the same settings. This is the line where the issue is reflected, but the culprit is somewhere else (filter.module, line 723):

        // Unpack stored filter settings.
        $filter->settings = (isset($filter->settings) ? unserialize($filter->settings) : array());

Any idea how to avoid this annoying issue?

jazzitup’s picture

Priority: Critical » Minor

I've just found what causes my issue!!

Since long time ago I've been following certain steps in order to migrate a site to localhost. One of the steps was to replace all appearances of www.xyz.com to my.local within the mysql dump. When doing it manually (aggressively), of course it may cause some unpredictable issues like this. Within the settings column of filter table and within value column of the variables table there are numerous appearances of the original domain name such as s:31:"www.xyz.local";. Of course, my real domain name was 31 characters long and when I replaced it with my.local, s:31 was no longer relevant! Therefore unserialize() complained and the whole site went down!

Perhaps the original issue was also not related to WYSIWYG module. I hope my finding may help somebody out there.

geek-merlin’s picture

Title: Operand error since Drupal 7.10 upgrade » Changing serialized string in the DB leads to "Operand error"
Status: Postponed (maintainer needs more info) » Closed (works as designed)

OK i guess we all had times where we shot in our knees like this ;-). Great you shared...

geek-merlin’s picture

Title: Changing serialized string in the DB leads to "Operand error" » Operand error since Drupal 7.10 upgrade
Status: Closed (works as designed) » Postponed (maintainer needs more info)

Hups, others may have different shootings...