Download & Extend

Incompatibility with the Mailhandler module

Project:Path Filter
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Path Filter doesn't seem to be compatible with the Mailhandler module. If I enable Path Filter and assign it to the same Input Filter used on my Mailhandler settings page, I get the following error:

An error occurred. /batch?id=23&op=do
Fatal error: Cannot use object of type stdClass as array in /sites/all/modules/pathfilter/pathfilter.module on line 247

Without the Path Filter module enabled, it works just fine. I'm using Path Filter 6.x-2.x-dev (2009-Dec-13) and Mailhandler 6.x-1.8.

Comments

#1

Status:active» closed (cannot reproduce)

I'm unable to reproduce this issue, and since it's well over a year old and noone else has reported the same thing, I'm gonna close it.

#2

Status:closed (cannot reproduce)» active

We also received a similar error with WebFM and Pathfiler:

"PHP Fatal error: Cannot use object of type webfm_fdesc as array in ***drupalroot***\\sites\\all\\modules\\pathfilter-6.x-2.0-beta3\\pathfilter.module on line 235

Here's the relevant offending code:

   foreach($node as $key => &$value) {
      //if this is the body or teaser lets run our replaces
      if ($key == "body" || $key == "teaser") {
        if (in_array($node->format, $defined_formats)) {
          $func_name($node->format, $value);
        }
      }
      elseif (is_array($value)) {
        // Look at the rest of the fields...if they have a format from our defined formats list
        // and we have a value that is a string run our replace...otherwise ignore them
        if (!empty($value[0]['format']) && in_array($value[0]['format'], $defined_formats) &&
          !empty($value[0]['value']) && is_string($value[0]['value'])) {    /// LINE 235!
            $func_name($value[0]['format'], $value[0]['value']);
        }
      }

I used a temporary kludge to prevent the HTTP 500 error message like so:


elseif (is_array($value)) {
if (is_object($value[0])) {
drupal_set_message("Pathfilter is dodging an object bullet");
}

// Look at the rest of the fields...if they have a format from our defined formats list
// and we have a value that is a string run our replace...otherwise ignore them
elseif (!empty($value[0]['format']) && in_array($value[0]['format'], $defined_formats) &&
!empty($value[0]['value']) && is_string($value[0]['value'])) {
$func_name($value[0]['format'], $value[0]['value']);
}
}