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.
Comment | File | Size | Author |
---|---|---|---|
#1 | references-V7.2.2_30dev-Fix_nid_validation-190118.patch | 1.02 KB | Louis Delacretaz |
feeds-references-issue-2.patch | 946 bytes | Christofer Roth | |
Comments
Comment #1
Louis Delacretaz CreditAttribution: Louis Delacretaz commentedIn 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.
Comment #2
rod-on CreditAttribution: rod-on as a volunteer and commentedPatch #1 works for me.
Louis, thanks!