General description
When creating a feed and mapping to a node id it will not validate the id.

I guess the same would occur for user ids, since the code is similar.

Problem
node_reference_potential_references takes parameter $options which should be an array of options, with keys "string", "match", "ids" and "limit". What is passed from references_feeds_set_target is instead array(int).

if ((is_int($options['string']) || ctype_digit($options['string'])) && $options['string'] > 0 && $options['string'] !== '') {
          // Make sure it is a valid node id or user id for this field.
          $matches = $validate_function($info, array($options['string']);

Possible solution
Since this will never work this patch instead reformats the existing options array so that 'string' is empty and 'ids' is equal to array([integer value]).

Workaround
You could still map the imported feed value to a node title or user name.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Louis Delacretaz’s picture

In version 2.2+30-dev (2018-07-29) this is still an issue but the root cause is that the validation function node_reference_potential_references always looks up node titles and therefore fails when a nid is passed in.

Fix was to explicitly validate the value given against node.nid.

rod-on’s picture

Patch #1 works for me.
Louis, thanks!