After applying patch at http://cgit.drupalcode.org/redhen/commit/modules/redhen_relation?id=825b...

We get an error on trying to implode $relation_types which is not an array (because it's NULL in our case).

I think the following explains what's happening (again, I think).

function redhen_relation_relations($entity, $relation_types = NULL, $active = FALSE)

$relation_types is default NULL

The patch checks if $relation_types exists and is not an array, but NULL bypasses this check and it's never set to an array

if ($relation_types && !is_array($relation_types)) {
  $relation_types = array($relation_types);
}

Then we try to implode $relation_types which is possibly NULL

$related_entities = &drupal_static(__FUNCTION__ . $entity->entityType() . $entity->internalIdentifier() . implode('-', $relation_types) . $active, array());

Propose to set $relation_types = array() in function definition

CommentFileSizeAuthor
#6 2662294.patch544 bytesnikunjkotecha
#5 2662294.patch736 bytesnikunjkotecha

Comments

darkodev created an issue. See original summary.

darkodev’s picture

Issue summary: View changes
darkodev’s picture

Title: Redhen relation path still showing errors on $relation_types » Redhen relation patch still showing errors on $relation_types
nikunjkotecha’s picture

+1
agree with the problem and solution both

nikunjkotecha’s picture

StatusFileSize
new736 bytes

adding patch

nikunjkotecha’s picture

StatusFileSize
new544 bytes
MichaelSt’s picture

I'm having the same issues... Is this patch from #6 working for anyone/everyone?

Thanks!

nikunjkotecha’s picture

Its working for me MichaelSt, but it needs to be applied after the patch from http://cgit.drupalcode.org/redhen/commit/modules/redhen_relation?id=825b...

MichaelSt’s picture

#6 applied after http://cgit.drupalcode.org/redhen/commit/modules/redhen_relation?id=825b... also seems to be working for me - trying it on test site and no error messages.

Thanks nikunjkotecha.

socialnicheguru’s picture

Status: Active » Needs review
kristiaanvandeneynde’s picture

Status: Needs review » Reviewed & tested by the community

Works fine, code change is simple and self-explanatory.

MichaelSt’s picture

FYI, I needed to add this patch (without the parent patch) to keep this error from happening after upgrading to 7.x-1.12.

johnhanley’s picture

Confirmed. This patch solves the runtime error shown when viewing an organization's connections page (exp. redhen/org/1/connections) with Redhen 7.x-1.12:

Warning: implode(): Invalid arguments passed in redhen_relation_relations() (line 533 of /sites/all/modules/redhen/modules/redhen_relation/redhen_relation.module).

  • gcb committed da3edef on 7.x-1.x authored by nikunjkotecha
    Issue #2662294 by nikunjkotecha: Redhen relation patch still showing...
gcb’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patch @nikunjkotecha!

Status: Fixed » Closed (fixed)

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