Problem/Motivation

On line 714 of filter.module we check whether $filter->settings exists before unserializing it and then merging it into another array on line 717.

However, as unserialize() returns FALSE on a fail, this can lead to "Fatal error: Unsupported operand types".

This may occur if $filter->settings is set to something other than an array (unlikely), or the unserialize() operation fails due to an encoding problem. An example of the kind of encoding problem that can occur is if an sql dump is uploaded with an incorrect encoding, or it is uploaded with the correct encoding, but its actual encoding is different.

Some examples of this occurring are noted in #1363580.

Proposed resolution

$filter->settings should be correctly initialised as an array prior to the merge operation, even if unserialise() has failed. It may be desirable to show a warning in this case.

Remaining tasks

  1. Roll a patch

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#3 filter_type_cast-2378951-3.patch858 bytesmadhavvyas
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jorge Navarro’s picture

Issue summary: View changes
xtfer’s picture

Title: Operand error filter.module » Character encoding issues can break filter settings
Category: Task » Bug report
Issue summary: View changes
Priority: Normal » Major
madhavvyas’s picture

Status: Active » Needs review
FileSize
858 bytes

Fixed array type casting issue in filter module