Inside cer.crud.inc on line 45, $referenced_entity->{$keys['away_field']} is passed into array_key_exists() as the second parameter but the following appears to be generated when array_key_exists() is supplied with a NULL value as its second parm:

Notice: Undefined property: stdClass::$field_product_assoc_servers in cer_insert() (line 45 of C:\www\projects\foobar\sites\all\modules\cer\cer.crud.inc).
Warning: array_key_exists() expects parameter 2 to be array, null given in cer_insert() (line 45 of C:\www\projects\foobar\sites\all\modules\cer\cer.crud.inc).
Notice: Undefined property: stdClass::$field_pro_assoc_servers in cer_insert() (line 45 of C:\www\projects\foobar\sites\all\modules\cer\cer.crud.inc).
Warning: array_key_exists() expects parameter 2 to be array, null given in cer_insert() (line 45 of C:\www\projects\foobar\sites\all\modules\cer\cer.crud.inc).
Notice: Undefined property: stdClass::$field_pro_assoc_servers in cer_insert() (line 45 of C:\www\projects\foobar\sites\all\modules\cer\cer.crud.inc).
Warning: array_key_exists() expects parameter 2 to be array, null given in cer_insert() (line 45 of C:\www\projects\foobar\sites\all\modules\cer\cer.crud.inc).
Notice: Undefined property: stdClass::$field_pro_assoc_servers in cer_insert() (line 45 of C:\www\projects\foobar\sites\all\modules\cer\cer.crud.inc).
Warning: array_key_exists() expects parameter 2 to be array, null given in cer_insert() (line 45 of C:\www\projects\foobar\sites\all\modules\cer\cer.crud.inc).

Keep the following example in mind:

	const LANGUAGE_NONE = 'TEST';

	$search_array = array('first' => null);

	var_dump(isset($search_array['first']));//Returns false...
	var_dump(array_key_exists('first', $search_array));//Returns true...


	if (array_key_exists(LANGUAGE_NONE, $search_array['first']) == FALSE || $search_array['first'][LANGUAGE_NONE][0]['target_id'] == NULL) {
		print 'Success!';
	}

Now consider this...

...
// Add the new reference.
// If there are no other references, we need to make sure this
// is delta 0
+if(isset($referenced_entity->{$keys['away_field']})){
   if (array_key_exists(LANGUAGE_NONE, $referenced_entity->{$keys['away_field']}) == FALSE || $referenced_entity->{$keys['away_field']}[LANGUAGE_NONE][0]['target_id'] == NULL) {
      $referenced_entity->{$keys['away_field']}[LANGUAGE_NONE][0]['target_id'] = $home_entity->$ids['home'];
   }
+}
else {
// Add the new reference.
...

Is this the correct fix for this issue? I looked in the CER table and $field_product_assoc_servers is listed multiple times, and yet, $field_product_assoc_servers doesn't even exist in the fields I have! Anywhere! It did at one point, but is no longer being used... Which makes me wonder if lines 30 and 31 are looping through the correct pieces of data... For example, is CER looping through the actual field values or instead only looping through the memory locations... That sort of thing.

In any event, something is wrong here and some insight would be appreciated. I'll keep trying to figure this one out until I hear from someone on here.

Comments

wolf_22’s picture

On line 45, you need to use isset() on $referenced_entity->{$keys['away_field']}.

(FYI)

phenaproxima’s picture

Status: Active » Needs review

Should now be fixed as part of http://drupal.org/node/1971250.

phenaproxima’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev

Fixed in the 2.x branch (use git to get a copy of it).

chertzog’s picture

Status: Needs review » Fixed

7.x-1.x is deprecated.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.