Hi! I just installed this module, and when I click to set up the Mapping, I get the following error:

Fatal error: Unsupported operand types in .../sites/all/modules/feeds_xpathparser/FeedsXPathParser.inc on line 220

Looks like it is complaining about this line:
+ parent::getMappingSources();

Can you please help me resolve this issue?
Thanks!
-Jen

CommentFileSizeAuthor
#4 FeedsJSONPathParser.inc_.patch488 bytesphl3tch

Comments

twistor’s picture

Assigned: Unassigned » twistor

What version of Feeds are you running? Sorry for the delay.

moondancerjen’s picture

I'm using 6.x.1.7. I checked 1.8 and it had the same line, so I didn't upgrade. To get this to work I changed the function to this:

  /**
  * Override parent::getMappingSources().
  */
  public function getMappingSources() {
  parent::getMappingSources();
    return array(
      'xpathparser:0' => array(
        'name' => t('XPath Expression'),
        'description' => t('Allows you to configure an XPath expression that will populate this field.'),
      ),
    );// + parent::getMappingSources();
  }

And that has gotten rid of the error, but I don't know if the module is behaving properly. In fact, when I go to edit my feed I can only give one XPath query to run even though I have set up about 5 fields that I'd like to map. Maybe this is a result of my alteration?

twistor’s picture

Your changes would only affect field inheritance. Sorry, I meant what version of Feeds not feeds_xpathparser.

phl3tch’s picture

StatusFileSize
new488 bytes

It looks like in the most recent version of Feeds, the FeedsParser plugin's getMappingSources() simply returns false. You can't union an array and false, hence the error. The fix in #2 should be fine, but I rolled a patch that checks whether parent::getMappingSources() is an array. If it is, it adds it. If not, it adds an empty array. A bit more robust a solution.

twistor’s picture

I'm not totally opposed to this patch, however, in feeds-6.x-1.0-beta9 and dev, FeedsParser::getMappingSources() looks like:

  public function getMappingSources() {
    self::loadMappers();
    $sources = array();
    drupal_alter('feeds_parser_sources', $sources, feeds_importer($this->id)->config['content_type']);
    if (!feeds_importer($this->id)->config['content_type']) {
      return $sources;
    }
    $sources['parent:uid'] = array(
      'name' => t('Feed node: User ID'),
      'description' => t('The feed node author uid.'),
    );
    return $sources;
  }

It used to return FALSE a while ago, but to my knowledge, the only FeedsParser plugin that returns FALSE anymore is the CSVParser.

twistor’s picture

Status: Active » Fixed

Committed a fix for this since the Feeds version isn't stated.

http://drupal.org/cvs?commit=437544

Status: Fixed » Closed (fixed)

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