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

alberthendriks’s picture

For reproduction, after making a corresponding node reference, edit such a node to add referenced nodes, and save it.

czigor’s picture

I 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.

czigor’s picture

Status: Active » Postponed (maintainer needs more info)
solide-echt’s picture

Version: 6.x-4.1 » 7.x-4.x-dev

I 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

czigor’s picture

Can someone give the steps to reproduce this? Node type language settings and node language settings, field cardinalities (1,2.. unlimited) might also matter.