When I tried to import feed I got following error:

An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /batch?id=8&op=do StatusText: OK ResponseText: Fatal error: Unsupported operand types in \sites\all\modules\feeds\includes\FeedsConfigurable.inc on line 150

I'm not sure about status of Feeds for Drupal 7. Is it worked, tested? I want to use this module to import feed items to nodes. And if it doesn't work I would like to fix it. I just need to know what exact I need to fix for this module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

furamag’s picture

It looks like we have bug in function getConfig on line 148 in includes/FeedsConfigurable.inc . There is code which should fix it:

  public function getConfig() {
    $defaults = $this->configDefaults();
    if (!is_array($this->config)) $return = $defaults;
    elseif (!is_array($defaults)) $return = $this->config;
    else $return = $this->config + $defaults;
    return $return;
  }
furamag’s picture

Category: support » bug
sime’s picture

Priority: Normal » Critical

This makes it impossible to run any import that uses any plugin that has no config.

sime’s picture

Title: AJAX error » NULL $config causing "Unsupported operand..."

Code in #2 technically fixes the fatal error of course. However, there is a similar issue in addConfig() in the same file which results in:

Warning: array_merge(): Argument #2 is not an array in FeedsConfigurable->addConfig() (line 127 of /Users/admin/Sites/phoenix/sites/all/modules/contrib/feeds/includes/FeedsConfigurable.inc).
sime’s picture

FileSize
999 bytes

I don't have the ideal solution because it seems to me that ->config() should always return an array so the best solution should go a bit deeper. This is simply patch I'm using to avoid this problem, and which I'm referencing in a drush make file.

David Goode’s picture

Version: 7.x-2.0-alpha2 » 7.x-2.x-dev
Status: Active » Needs work
FileSize
1015 bytes

What specific importer gave this problem? Was it a custom one? Does it have to be attached to a node? I couldn't reproduce the error with a number of standard importers in the most recent CVS checkout.

Here is a potential solution, although the actual issues need to be elaborated a bit. Basically, these configuration functions all assume that they will be passed an actual array. The array can be empty. The default config also must be array. This is a reasonable spec, so any errors are really the fault of the implementing classes or procedures. However, it might be nice to support the common use case of passing something that might be NULL instead of having to cast it to an empty array. For this, we can just cast the argument to an array and it should then work fine. I don't think we need any argument checking beyond this.

sime’s picture

The standard importers all work because they have default config so the arrays are never null. I'm currently using custom fetcher/parser. I'm working on them today so I will have a double check that I've not done anything silly.

sime’s picture

Let's try a minimal parser plugin. We don't need it to do any meaningful parsing of course, since it won't get that far due to the error we're discussing. If you add this to an importer, and try and run it on /import you reproduce the problem.


/**
 * Feeds parser plugin that gathers NetSuite entities from type/internalid values.
 */
class SketchyParser extends FeedsParser {

  /**
   * Implements FeedsParser::parse().
   */
  public function parse(FeedsSource $source, FeedsFetcherResult $fetcher_result) {

    // For the sake of the example it doesn't matter what we do here anyway.
    return new FeedsParserResult(null, null);
  }

  /**
   * Define default configuration.
   */
  public function configDefaults() {
    return array();
  }

  /**
   * Build configuration form.
   */
  public function configForm(&$form_state) {
    $form = array();
    return $form;
  }

}

Off-topic: I suffered from not having any minimal examples of feeds plugins when I started working with feeds. You mention that the current issue is potentially a problem of the plugin not implementing methods properly, but there is no documentation about this as far as I can find. I ended up taking the complex examples in the feeds module itself and stripped them back of what wasn't needed.

johnv’s picture

David, i had the same problem with 7.x-2.x-alpha2. After applying #1, the error disappeared.
I just installed 7.x-2.x-dev of 25-dec2010, without applying any patches yet. The error does not appear in this version. Perhaps it resolved itself with other issues..

David Goode’s picture

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

Still unable to reproduce this error on latest checkout. I also don't see why overriding functions with the exact same function definitions should change anything. I see where there could possibly be some problems with the form submission returning NULL values instead of empty arrays or something and then calling add_config with this argument, but I haven't seen this actually happen, and most likely this is against the spec of the form_values array element, so I don't think it's worth doing even my tiny patch. If you experience this problem with a specific step on the latest version of feeds, with a properly created configurable plugin, then please track down how the error occurs and post specifics, and ideally a well-contained fix of your own. Thanks.

sime’s picture

Status: Postponed (maintainer needs more info) » Active

Reading into that, you haven't implemented the sample I provided. I will soon provide more thorough steps to reproduce and a patch.

I agree it's not critical from my viewpoint because it doesn't effect the plugins that ship with Feeds.

David Goode’s picture

Priority: Normal » Major
Status: Active » Reviewed & tested by the community

Note this is related to the following for the D6 version: http://drupal.org/node/625196. Also, was able to reproduce as that version says, namely by creating feed items that are themselves feeds. This causes an error because $node->feeds is not yet populated. The patch I posted earlier fixes this use case, and I think is fine, so I'll set this to RTBC based upon my patch in #6 for Alex to look at. Sorry for doubting you previously :-)

sime’s picture

cool :)

twistor’s picture

Think we can get this patch in? I have a project that depends on it.

http://drupal.org/project/feeds_selfnode_processor.

twistor’s picture

Patch in #6 works for 6 and 7 versions.

tomcatuk’s picture

subbing on this one.

kking’s picture

I'm having trouble reproducing this error (I took the generic parser from post #8). Is anyone still having issues with this in the latest Alpha? If so, can you please provide detailed instructions on how to produce the error?

kking’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)
MGParisi’s picture

FileSize
0 bytes

I am, I am using shared ANHosting (they may limit outside connections), and I have the following feed importing

http://www.swtor.com/feed/news/all

The content type is has no fields, is not published to the front page, basic content type.

MGParisi’s picture

Version: 7.x-2.x-dev » 7.x-2.0-alpha3
Status: Postponed (maintainer needs more info) » Needs work

Hope I can change this status, installed latest version. Im usually on IRC, Drupal or Drupal-contribute channels. I cant apply patches (yet) still setting up Eclipse and windows + .Patch files stink, so if you could include the files as well as the patch if you want me to fix it.

As for me, I probably wont keep this installed for long. I really only want a RSS widget, probably flash or java based. I just need something to show me the current RSS, I dont really want to import the stuff.

deastlack’s picture

The error listed below arises when trying to import a CSV file of date extracted from a drupal 5 based site. it contains info from node, node_revision, and cck table (See Select Query). My CSV file did have a header row. I cloned the node import and mapped those fields required for the new content type in drupal 7. Used the field names listed in the query below and selected target fields from the drop-down list. Not all fields were mapper to the D7 content type, nor were all fields in the D7 content type to be populated. Not sure how to correctly handle the GUID, since I am looking to create new nodes not import RSS items (yet)
no fields in the D7 content type are required.

I'm attaching to this issue thread because of the similarity of the error message.

SELECT QUERY
SELECT
n.nid,
n.vid,
n.type,
n.title,
c.field_mc_description_value,
c.field_mc_contact_email_email,
c.field_mc_website_url,
c.field_mc_website_title,
c.field_mc_website_attributes,
c.field_phone_value,
c.field_fax_value,
c.field_toll_free_value,
c.field_cfc_code_value,
c.field_social_media_widgets_value,
c.field_social_media_widgets_format

FROM node n left join test.node_revisions r on n.nid = r.nid and n.vid = r.vid left join content_type_blah_yada c on n.nid = c.nid and n.vid = c.vid where type = 'blah_yada';
END QUERY
ERROR TEXT
An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /drupal-
7.0/?q=batch&render=overlay&id=25&op=do StatusText: parsererror ResponseText: ( ! ) Fatal error: Unsupported operand types in C:\wamp\www\drupal-7.0\sites\all\modules\feeds\includes\FeedsConfigurable.inc on line 150 Call Stack #TimeMemoryFunctionLocation 10.0002374728{main}( )..\index.php:0 20.409335849744menu_execute_active_handler( )..\index.php:22 30.418136804016call_user_func_array ( )..\menu.inc:501 40.418236804152system_batch_page( )..\menu.inc:0 50.418336804152_batch_page( )..\system.admin.inc:2282 60.418336804688_batch_do( )..\batch.inc:81 70.418336804688_batch_process( )..\batch.inc:162 80.420736895448call_user_func_array ( )..\batch.inc:285 90.420736895472feeds_batch( )..\batch.inc:0 100.464040461200FeedsSource->import( )..\feeds.module:150 110.525640656704FeedsProcessor->process( )..\FeedsSource.inc:350 120.545141370048FeedsNodeProcessor->entitySave( )..\FeedsProcessor.inc:131 130.545141370048node_save( )..\FeedsNodeProcessor.inc:75 140.573541763680module_invoke_all( )..\node.module:1134 150.575341769096call_user_func_array ( )..\module.inc:817 160.575441769280feeds_node_insert( )..\module.inc:0 170.576341772144feeds_node_update( )..\feeds.module:480 180.592041821896FeedsSource->save( )..\feeds.module:504 190.592041821896FeedsConfigurable->getConfig( )..\FeedsSource.inc:477
ENDTEXT

dynamicdan’s picture

I had this problem too... suggested fix #1 fixed the import.. very happy now.

To cause the problem I:
- had drupal 7.1.0-rc4 (default download from drupal for v7)
- installed Feeds: 7.x-2.0-alpha3
- cloned the existing node importer
- changed new clone to import to a (very simple) custom content type
- created a 2 row (+header) simple import CSV file
- loaded /import
- chose file, clicked import -> got error!

rickmanelius’s picture

Currently having this error... subscribing before I test the patch in #6.

rickmanelius’s picture

I can confirm that this is fixing the problem stated in the original post of this issue. The nodes do import, but I then see this error:

Resource is not a file or it is an empty directory:

It doesn't prohibit the import, but I just wanted to make you all aware of that.

FYI: I got this error when trying the node references patch/mapper #988856: Feeds mapper for node_reference and user_reference fields and then deleting that mapping before importing just the node title.

I would say patch #6 in and open new tickets to deal with remaining issues.

Dave Reid’s picture

rocket777’s picture

subscribing
had similar issue with importing from a cloned node importer #6 fixed it for me.

awm’s picture

subscribe

BeauTownsend’s picture

Issue summary: View changes

I encountered this error upon disabling my custom module. In my implementation, I'm using a custom processor via hook_feeds_importer_default() and a sub-class of FeedsProcessor. I spent hours poring over this post, as well as https://www.drupal.org/node/625196, and while I found some good tips for tightening up my code, I continued to receive this error upon disabling my module.

The solution ended up being simple. My sub-class of FeedsProcessor had an empty configDefaults() method. Once I added return parent::configDefaults(), the error went away.