Helo

Im aggregating rss 2.0 feed and get error on cron run and refresh:

Fatal error: Call to a member function init() on a non-object in /home/podcast/public_html/sites/all/modules/feedapi_eparser/feedapi_eparser.plugins.inc on line 308

thanx for help

Comments

EmanueleQuinto’s picture

I had the same problem and after checking the code of feedapi_eparser.plugins.inc I found the lines (amended in the following of the discussion) that create the problem:

file: feedapi_eparser.plugins.inc
line 308: function init()

    $this->parsed_source = new stdClass();
    foreach ($efeed->eparse->namespaces as $namespace) {
      $this->ensure_namespace($namespace);
      if($this->namespace_plugins[$namespace]) $this->namespace_plugins[$namespace]->init($this->xml, $this->parsed_source);
    }
  }

I added the if command because ensure_namespace method could set the array plugins to false:

      if (isset($def['handler']) && class_exists($def['handler'])) {
        $this->namespace_plugins[$namespace] = new $def['handler'];
      }
      else {
        $this->namespace_plugins[$namespace] = false;
      }

Now either this function should return a value (TRUE or FALSE) depending on the test OR we have to check $this->namespace_plugins[$namespace]

A similar problem occurs in parse()

Line 316:

    foreach ($this->namespace_plugins as $plugin) {
      if(is_object($plugin)) $plugin->parse_global($global_context);
    }
    $this->parse_global();

Line 324:

      foreach ($this->namespace_plugins as $plugin) {
        if(is_object($plugin)) $plugin->parse_item($xml_item, $item);
      }

Don't know if is_object it's the right test...

I submit a patch as soon as possible (still debugging and a lot of print_r, dpm, dsm, var_dump around in my code.

neclimdul’s picture

Status: Active » Fixed

Thanks I've already committed a fix for this. An array_filter before saving the settings fixes the problem.

Status: Fixed » Closed (fixed)

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