Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Notice: Undefined variable: allowed_references in corresponding_node_references_update() (line 161 of /extra/home/vhosts/roos/dev/www/sites/all/modules/contrib/cnr/corresponding_node_references.crud.inc).
To reproduce, make a corresponding node reference between two node references where you can make unlimited references.
To fix, I have the following patch:
--- corresponding_node_references.crud.inc (revision 439)
+++ corresponding_node_references.crud.inc (revision 440)
@@ -158,7 +158,7 @@
//check for reference overloading
$references = count($referenced_node->{$away_field}) + 1;
- if (($allowed_references >= $references) || $unlimited) {
+ if ($unlimited || ($allowed_references >= $references)) {
$referenced_node->{$away_field}[] = array('nid' => $home_node->nid);
_corresponding_node_references_update($referenced_node);
}
Comments
Comment #1
alberthendriks CreditAttribution: alberthendriks commentedFor reproduction, after making a corresponding node reference, edit such a node to add referenced nodes, and save it.
Comment #2
czigor CreditAttribution: czigor commentedI could not reproduce this error message on a clean install. Can you add further details? What php version are you using?
Uninitialized integer variables default to 0, so the first part of the if condition should be an ordinary FALSE.
Comment #3
czigor CreditAttribution: czigor commentedComment #4
solide-echt CreditAttribution: solide-echt commentedI reproduced this error using latest dev version of cnr. PHP is version 5.3.6, database is PostgresQL 9.1 When I disable cnr and update the node with multiple references everything is OK. Applying the patch in my configuration does not remove the message.
Hope this helps,
eric
Comment #5
czigor CreditAttribution: czigor commentedCan someone give the steps to reproduce this? Node type language settings and node language settings, field cardinalities (1,2.. unlimited) might also matter.